Available Functions
This documentation assumes you are using the API as follows:
var vzp = new vzPlayer("vzvd-10355742");
vzp.ready(function() {
// Your code
});Playback
Play a Video
vzp.play() Plays the video, if it is paused or not yet started. Replays the video if it is at the end.
Pause a Video
vzp.pause() Pauses the video if it is playing.
Toggle a Video Between Playing and Paused
vzp.playPause() Toggles the play/pause status of the video as follows:
- Play the video if it is currently paused
- Pause the video it if it is currently playing
- Play the video if it has not yet started
- Replay the video if it is at the end
Seek to a Position in the Video
vzp.seekTo(seconds:Number) Seeks to the specified position in the video (in seconds).
Get the Current Play Time
vzp.getTime(function(time) { ... }) Returns the current play time of the video to the callback function (in seconds, to 2 decimal places).
Get the Duration of the Video
vzp.getTotalTime(function(time) { ... }) Returns the duration of the video to the callback function (in seconds, to 2 decimal places).
Volume
Get the Player Volume
vzp.getVolume(function(vol) { ... }) Returns the current volume of the player to the callback function (from 0 to 5, where 0 is muted).
Set the Player Volume
vzp.setVolume(volume:int) Sets the volume of the player to the specified value (from 0 to 5, where 0 is muted).
Mute the Player Volume
vzp.muteOn() Mutes the player if it is currently unmuted.
Mute the Player Volume
vzp.muteOff() Unmutes the player if it is currently muted.
Toggle the Player Volume Mute Status
vzp.muteToggle() Toggles the mute status of the player on or off, depending on its current status.
Get the Current Mute Status of the Player
vzp.getMute(function(value) { ... }) Returns the current mute status of the player to callback function (true/false).
Events
When the player is ready, you can add events using:
vzp.addEventListener(event:String, function(value) { ... })
This will listen for events dispatched from the player and execute the listener function. The following events are available:
Play State
playState
Dispatched when playback begins ("mediaStarted"), ends ("mediaEnded"), is playing ("mediaPlaying") and is paused ("mediaPaused").
Progress
progress Dispatched every 10% of the media viewed ("10percent", "20percent", etc).
Interaction
interaction
Dispatched on the following player interactions: fullscreenofffullscreenonpauseresumeseekbarsoundOffsoundOn