Send events to the player
Send events
You can send events to the player
Event | Parameter | Description |
---|---|---|
play | - | Start playback. |
pause | - | Pause playback. |
togglePlay | Boolean | Toggle playback, if no parameters are passed, it will toggle based on current status. |
destroy | - | Destroy the instance and garbage collect any elements. |
increaseVolume | Number | Increase volume by the specified step. If no parameter is passed, the default step will be used. |
decreaseVolume | Number | Increase volume by the specified step. If no parameter is passed, the default step will be used. |
toggleCaptions | Boolean | Toggle captions display. If no parameter is passed, it will toggle based on current status. |
toggleControls | Boolean | Toggle the controls (video only). Takes optional truthy value to force it on/off. |
fullscreen.exit | - | Exit fullscreen. |
fullscreen.toggle | - | Toggle fullscreen. |
forward | Number | Fast forward by the specified seek time. If no parameter is passed, the default seek time will be used. |
rewind | Number | Rewind playback by the specified seek time. If no parameter is passed, the default seek time will be used. |
currentTime | Number | Current time in seconds to be setted |
volume | Number | Currentvolume 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 });