Send events to the player

Send events

You can send events to the player

EventParameterDescription
play-Start playback.
pause-Pause playback.
togglePlayBoolean Toggle playback, if no parameters are passed, it will toggle based on current status.
destroy-Destroy the instance and garbage collect any elements.
increaseVolumeNumber Increase volume by the specified step. If no parameter is passed, the default step will be used.
decreaseVolumeNumberIncrease volume by the specified step. If no parameter is passed, the default step will be used.
toggleCaptionsBooleanToggle captions display. If no parameter is passed, it will toggle based on current status.
toggleControlsBooleanToggle the controls (video only). Takes optional truthy value to force it on/off.
fullscreen.exit-Exit fullscreen.
fullscreen.toggle-Toggle fullscreen.
forwardNumberFast forward by the specified seek time. If no parameter is passed, the default seek time will be used.
rewindNumberRewind playback by the specified seek time. If no parameter is passed, the default seek time will be used.
currentTimeNumberCurrent time in seconds to be setted
volumeNumberCurrentvolume to be setted

Usage

const iframe = document.getElementById('panda-player').contentWindow;

// without params
iframe.postMessage({ type: 'play' });

//with params
iframe.postMessage({ type: 'forward', parameter: 5 });