-
Notifications
You must be signed in to change notification settings - Fork 46
JavaScript API
.addPlayer(parameters)
- adds the player to any element of the page, should only be used once when declaring the player
-
parameters
- optional JSON object containing parameters, currently only supportsmultiscreen
(boolean, defaults to "false", see multiscreen demo)
.state()
- get state in human readable format
.stateInt()
- get state in int format
.play()
- start playing the current playlist item
.pause()
- pause player
.togglePause()
- toggles pause
.stop()
- stops the player
.playing()
- returns true if the player is playing or false otherwise
.position(float)
- get/set playback time in milliseconds
.time(int)
- get/set normalized position in multimedia stream item given as a float value between [0.0 - 1.0]
.width()
- get video's original width
.height()
- get video's original height
.length()
- get video's total length in milliseconds
.addPlaylist(playlist)
- Adds videos to the playlist (accepts strings, arrays and objects)
.next()
- iterate to the next playlist item
.prev()
- iterate to the previous playlist item
.itemCount()
- returns the number of playlist items
.currentItem(i)
- get/set the current playlist item
.playItem(i)
- set the current playing playlist item
.removeItem(i)
- removes a playlist item
.clearPlaylist()
- clears the current playlist and stops the player
.advanceItem(i, count)
- change item position within playlist
.volume(int)
- get/set volume (can be an integer between 0 and 200, if no value set it will return the current volume)
.toggleMute()
- toggle mute
.mute(bool)
- get/set mute (boolean, if no value set it will return the current mute state)
.onMediaChanged(function)
- triggers when the playlist item has changed
.onIdle(function)
- triggers when the player enters idle state
.onOpening(function)
- triggers when the player enters opening state
.onBuffering(function)
- triggers when the player is in buffering state
.onPlaying(function)
- triggers when the player enters playing state
.onPaused(function)
- triggers when the player enters paused state
.onStopped(function)
- triggers when the player enters stopped state
.onEnded(function)
- triggers when the player finished playing all playlist items
.onError(function)
- triggers when the player has encountered an error and is unable to continue
.onTime(function)
- triggers when the player's time changed
.onPosition(function)
- triggers when the player's position changed
.onForward(function)
- triggers when the player's fastforwarding through the media (works only when an input supports forward playback)
.onBackward(function)
- triggers when the player's going backwards through the media (works only when an input supports backwards playback)