new VideoPlayer(divTag) → {Zenterac.VideoPlayer}
A video player for interactive video broadcast
Parameters:
Name | Type | Description |
---|---|---|
divTag |
div | Html element where the video will be displayed |
Members
-
autoplay :Bool
-
Set if the players auto plays or stops between videos in a playlist (default: true)
-
<readonly> currentTime :Number
-
Current time of the current video
-
<readonly> duration :Number
-
Duration of the current video
-
fallbackElement :String
-
DOM element to be displayed for non-HTML5 browser
-
fallbackVideo :Zenterac.Video|String
-
Set fallback video ID for devices not supporting interactive videos
-
favoriteQuality :Zenterac.VideoQuality
-
Prefered video streaming quality (Default: Zenterac.VideoQuality.AUTO)
-
<readonly> height :Number
-
Height of the player
-
<readonly> htmlDiv :div
-
Div where the video is displayed
-
maxSegments :Number
-
Maximum number of video preload, has to be set before creating a player
-
<readonly> paused :Bool
-
Returns true if the player is paused
-
<readonly> session :Zenterac.Session
-
The session being used
-
<readonly> state :Zenterac.PlayerState
-
State of the player
-
<readonly> UI :Zenterac.Controls
-
Get the player user interface
-
useMultiSegment :Bool
-
If true, will use multiple video segments (require more CPU power, but required for preload, disabled by default on weak devices)
-
usePreloading :Bool
-
If true, preloading is enabled (via this.preload()), disabled by default on mobiles
-
user :Number
-
Get or set the user of the player
-
volume :Number
-
Get or set the volume of the player
-
<readonly> width :Number
-
Width of the player
-
<inner> endEvent :Event
-
Fired when the playlist has ended and the player stopped
Example
player.on('end', function(){});
-
<inner> initEvent :Event
-
Fired during initialization, only if a new session has been created
Example
player.on('init', function(){});
-
<inner> readyEvent :Event
-
Fired when the player is ready to play
Example
player.on('ready', function(){});
-
<inner> restartEvent :Event
-
Fired when the playlist is restarted
Example
player.on('restart', function(){});
-
<inner> startEvent :Event
-
init and restart events combined, ideal event for uploading the playlist
Example
player.on('start', function(){});
-
<inner> switchEvent :Event
-
Fired when a new video starts in the playlist (Alias: next)
Example
player.on('switch', function(newVideoID, prevVideoID){ });
-
<inner> timeupdateEvent :Event
-
Fired when the time is updated
Example
player.on('timeupdate', function(){});
Methods
-
addBookmark(id, callback)
-
Add a bookmark to the player, run bookmarks with player.runBookmarks('bookmark_id')
Parameters:
Name Type Description id
String ID of the bookmark, can be null (default bookmark) callback
function Function to call when running the bookmark -
addPlaylist(playlist, addMode)
-
Add a playlist to the player
Alias: VideoPlayer.append(playlist) = VideoPlayer.addPlaylist(playlist, Zenterac.AddMode.APPEND);
Alias: VideoPlayer.insert(playlist) = VideoPlayer.addPlaylist(playlist, Zenterac.AddMode.INSERT);
Alias: VideoPlayer.replace(playlist) = VideoPlayer.addPlaylist(playlist, Zenterac.AddMode.REPLACE);Parameters:
Name Type Argument Description playlist
Zenterac.Playlist | Zenterac.Video | String A playlist or a video to load addMode
Zenterac.AddMode <optional>
How the new new playlist should be added -
clear()
-
Clear remaining playlist
-
getCurrentVideo() → {Zenterac.Video}
-
Return current video being played
-
next()
-
Skip to next video in playlist
-
nextSync(offset)
-
Skip to next video in playlist, and sync it with current video
Parameters:
Name Type Description offset
Number Sync offset in seconds -
on(eventName, callback)
-
Add an event to the player
Parameters:
Name Type Description eventName
string event name (ready, timeupdate, restart, next, end) callback
function event callback -
onTime(video, time, callback)
-
Add a time cue point that will call code
Parameters:
Name Type Description video
String Video ID of the video that will trigger the cue point, set to "" to trigger on all videos time
Number Time at which the cue point will be triggered callback
function The function to call on the cue point, first param will be the ID of the video -
pause()
-
Pause the player
-
play(playlist)
-
Start the player or switch video
Parameters:
Name Type Argument Description playlist
Zenterac.Playlist <optional>
Optional: A new playlist to play (using AddMode.REPLACE) -
playSync(playlist, offset)
-
Switch video using sync method (set time of next video to time of current video)
Parameters:
Name Type Description playlist
Zenterac.Playlist A new playlist to switch to (will sync to time of current video) offset
Number Sync offset in seconds -
preload(video)
-
Ask the player to pre-load video so it is ready to play
Parameters:
Name Type Description video
Zenterac.Video a video to pre-load -
preprocess(video)
-
Ask the server to pre-process video for faster loading when client will load it
Parameters:
Name Type Description video
Zenterac.Video a video to pre-process -
refresh()
-
Force reload of current video, updating options, does not change playlist (useful for quality switch)
-
restart()
-
Restart the playlist defined in the 'init' event
-
resume()
-
Resume the player
-
runBookmark(id)
-
Run a bookmark added with player.addBookmarks('bookmark_id', function(){})
If id is not found, default bookmark is called (bookmark with null id)
Alias: player.runAnchorBookmark() = runBookmark(ZUtils.GetAnchor())Parameters:
Name Type Description id
String ID of the bookmark to run -
seek(time)
-
Seek current video to time
Parameters:
Name Type Description time
Number time in seconds -
unload(video)
-
Unload video client side to clear bandwidth and memory, will work only if video is not current video
Parameters:
Name Type Description video
Zenterac.Video a video to un-load, if undefined, will unload all videos except current