play
When autoplay is false or the Player is in paused mode, continues/starts Player activity.
Sample usage:
apiInterface.play();
pause
Pauses the Player activity, content video or ads, and sends the associated event or pause to demands.
Sample usage:
apiInterface.pause();
resize
Resizes the Player to the desired dimensions. Passes the dimensions as follows:
resize( width, height)
- width - Number, amount of pixels, should be greater than 0.
- height - Number, amount of pixels, should be greater than 0.
Sample usage:
apiInterface.resize(300, 400);
seekContent
Sets the content playing position. Content should be already defined and loaded. Passes the parameter as follows: seekContent(time)
- time - requested content position in seconds.
Sample usage:
apiInterface.seekContent(3.14);
getProgress
Retrieves the current position of playing video.
Sample usage:
let progress = apiInterface.getProgress()
Returns progress object (or null if nothing is playing):
- time - number, seconds, current video (content or ad) position. Can be null for unknown or negative if only remaining time is known.
- duration - number, seconds, current video (content or ad) duration. Can be null for unknown.
- content - boolean, true when content is currently playing.
- paused - boolean, player is paused.
sound
Sets the Player sound volume.
Note:
- For many VPAIDS, volume can't be controlled unlessthe sound is set to 'dynamic' in initiOverrides.
Passes the parameter of volume as follows: sound( volume)
- volume - boolean or number in [0;1] range.
Sample usage:
apiInterface.sound(0.7);
overrideInitParams
Changes the parameters of the Player. Can be used to change, extend, or augment Dashboard settings. Passes the parameters as follows: overrideInitParams(params)
-
params
Type: Object
Object that contains one or more properties that need to be overridden during
Possible params are:
- autoplay
- true - play when ready
- false - play after “play button” is clicked
- allowSound
- true - enable sound if possible
- false - mute sound completely
- ‘dynamic’ - disable sound but allow future unmute
- ‘must’ - enable sound and disable autoplay if necessary (on mobile)
- contentUrl
- video url string or comma separated list of URLs
- contentClickUrl
- URL where user will be redirected after clicking on content element
- contentImage
- image URL
- contentImagePosition
- ‘contain’ | ‘cover’ - see setContentImage for details
- rotate
- the maximum allowed advertising rotations
- skipButton
- true - show skip button
- false - default, do not show skip button
- closeButton
- true - show close button
- false - default, do not show close button
Sample usage:
apiInterface.overrideInitParams({
autoplay: false, // can be: true | false
allowSound: true, //can be: true | 'dynamic' | 'must'
contentUrl: 'http://example.com/video/content-video.mp4',
contentClickUrl: 'http://example.com/',
contentImage: 'http://example.com/content-image.jpeg',
contentImagePosition: 'contain', // 'cover'
rotate: 5,
skipButton: true,
closeButton: true,
});
skip
Stops playing the currently playing ad or content video, and starts playing the next one.
Sample usage:
apiInterface.skip();
pauseAds
Pauses a currently playing ad, stops sending requests for ads, and plays the content, meaning that content only is played in the current session (without ads).
Sample usage:
apiInterface.pauseAds();
resumeAds
Loads and starts playing ads. (Can be used after pauseAds, will resume the requests to the VASTs.)
Sample usage:
apiInterface.resumeAds();
close
Closes the Player (and stops playing), passes the parameter as follows: close(preserveDiv).
- preserveDiv - boolean:
- false - the default if not passed, after closing player remove self container from the dom
- true - after closing the Player, removes all elements except root container. (Uses this in case the Div contains object than the Player)
Sample usage:
apiInterface.close();
show
Makes the Player visible on the page.
Sample usage:
apiInterface.show();
getPlayerVersion
Returns the version of Cedato Player.
Sample usage:
apiInterface.getPlayerVersion();
setContent
In order to set the content, the content is passed using the following method: apiInterface.setContent(contentDescriptor)
The following properties of the contentDescriptor are optional:
-
video
- string or array, video URL(s)
- URL where user will be redirected after clicking on content element
- true - allow playing content in loop
- false - disable playing content in loop
- true - allow shuffling content video list
- false - disallow shuffling content video list
- true - show control bar for content
- false - do not show control bar for content
- url
- clickUrl
- loop
- shuffle
- controlBar
-
image
- image url string
- ‘contain’ | ‘cover’ - for details see setContentImage for details
- url
- position
Sample usage:
apiInterface.setContent({
video: "http://example.com/content-video.mp4",
image: "http://example.com/content-image.jpeg"})
apiInterface.setContent({
video: ["http://example.com/content-1.mp4","http://example.com/content-2.mp4"],
image: "http://example.com/content-image.jpeg"})
apiInterface.setContent({
video: {
url: 'http://example.com/video/content-video.mp4',
clickUrl: 'http://example.com/',
loop: true,
shuffle: true,
controlBar: true
},
image:{
url: 'http://example.com/content-image.jpeg',
position: 'contain',
}
});
setContentUrls
Sets a reference or a list of references for the content video. Passes parameters as follows: setContentUrls(contentUrl,samePosition)
- contentUrl - string, video URL or comma separated list of URLs
- samePosition - optional, boolean, preserve video position (time) when switching to a new video source.
Sample usage:
apiInterface.setContentUrls('http://example.com/content-1.mp4,http://example.com/content-2.mp4');
setContentImage
Sets the content image to be shown before the content video starts or before the advertising starts, and shown as background for the play button. Passes the parameters as follows:
setContentImage(imageUrl, position)
- imageUrl - string, fully qualified link to an image
- position - optional, string
- default (not set) - image is centered without scaling
- ‘contain’ - scales the image with the preservation of proportions so that the whole picture is fit into the unit
- ‘cover’ - scales the image with the preservation of proportions so that its width or height is equal to the width or height of the block
Sample usage:
apiInterface.setContentImage('http://example.com/content-image.jpeg', 'contain');