Player API actions

Player API actions

We have currently exposed only a limited number of Player API functions. If you need more, please get in touch.

ActionDescription
playPlays the player
pausePauses the player
currentTimeSets the current time in seconds (seek)
volumeSets the volume as a decimal

play

This tells the Player API to play the video:

vpJS.request('iframe_abcde12345abcde12345a', 'play');

pause

This tells the Player API to pause the video:

vpJS.request('iframe_abcde12345abcde12345a', 'pause');

currentTime

Sets the current time in seconds:

vpJS.request('iframe_abcde12345abcde12345a', 'currentTime', 10);

So if you would like to seek to a time, you will need to pass that time (in seconds) as the third parameter in the request.

ParameterTypeDescription
timeNumberThe time in seconds the player should seek to
callbackStringN/A (null)

volume

Sets the current volume, as a decimal:

vpJS.request('iframe_abcde12345abcde12345a', 'volume', 0.5);

So if you would like to change the volume, you will need to pass that volume (as a decimal) as the third parameter in the request.

ParameterTypeDescription
volumeNumberThe new volume
callbackStringN/A (null)