-
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
is optional, see supported parameters and demo usage)
.state()
- get state in human readable format (can be "idle", "opening", "buffering", "playing", "paused", "stopping", "ended" or "error")
.stateInt()
- get state in int format - Idle = 0, Opening = 1, Buffering = 2, Playing = 3, Paused = 4, Stopping = 5, Ended = 6, Error = 7
.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(i)
- get/set normalized position in multimedia stream item given as a float value between [0.0 - 1.0]
.rate(i)
- get/set input speed given as float (1.0 for normal speed, 0.5 for half speed, 2.0 for twice as fast, etc.)
.width()
- get video's original width
.height()
- get video's original height
.length()
- get video's total length in milliseconds
.aspectRatio(string)
- string, get/set aspect ratio (common values are "Default", "1:1", "4:3", "16:9", "16:10", "2.21:1", "2.35:1", "2.39:1", "5:4")
.crop(string)
- string, get/set crop (common values are "Default", "16:10", "16:9", "1.85:1", "2.21:1", "2.35:1", "2.39:1", "5:3", "4:3", "5:4", "1:1")
.zoom(i)
- int/float, get/set zoom, can be any positive number or float including 0 (zero hides the video feed completely)
.deinterlace(string)
- string, set deinterlace mode (can be 'disabled', 'blend', 'bob', 'discard', 'linear', 'mean', 'x', 'yadif' or 'yadif2x')
.fps()
- get video's frames per second returned as a float (typically 60.0, 50.0, 23.976, etc.)
.addPlaylist(playlist)
- Adds videos to the playlist (accepts strings, arrays and objects, see supported parameters and demo usage)
.next()
- iterate to the next playlist item
.prev()
- iterate to the previous playlist item
.itemCount()
- returns the number of playlist items
.itemDesc(i)
- returns the media object
.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(i)
- 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)
.audioCount()
- returns the number of audio tracks available
.audioTrack(i)
- gets/sets currently playing audio track by index number, a value of 0 means the audio is/will be disabled
.audioDesc(i)
- returns the i-th audio track name. 0 corresponds to disable and 1 to the first audio track
.audioDelay(i)
- change audio track delay (in milliseconds, can be positive or negative number)
.audioChan(string)
- string, get/set audio channel (can be "error", "stereo", "reverseStereo", "left", "right" or "dolby")
.audioChanInt(i)
- int, get/set audio channel in int format - Error = -1, Stereo = 1, Reverse Stereo = 2, Left = 3, Right = 4, Dolby = 5
External subtitles are set in .addPlaylist()
.subTrack(i)
- get/set the currently playing subtitle (internal video subtitles and external subtitles)
.subDesc(i)
- returns an object with information about the subtitle track (includes: language, type, url, ext)
.subDelay(i)
- change subtitle track delay (in milliseconds, can be positive or negative number)
.subCount()
- returns the total number of subtitles (interval video subtitles and external subtitles)
.toggleFullscreen()
- toggles fullscreen mode
.fullscreen(bool)
- boolean, true - maximize, false - minimize
.playlist(bool)
- optional boolean, sets playlist menu visibility, if no value set, it will return the playlist menu HTML element
.subtitles(bool)
- optional boolean, sets subtitle menu visibility, if no value set, it will return the subtitle menu HTML element
.ui(bool)
- boolean, sets User Interface visibility
.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
.onState(function)
- triggers when the event has changed (returns a string, can be "idle", "opening", "buffering", "playing", "paused", "stopping", "ended" or "error")
.onStateInt(function)
- triggers when the event has changed (returns a int, values can be 0 - 7)
.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)