To use the Panda Player API, you need to import the panda script into your web page.
Starting with Panda Player API
<script async src="https://player.pandavideo.com.br/api.v2.js"></script>To instantiate your player object, add the following code to your HTML:
<div style="width: 900px">
<div id="panda-XXXX"></div>
</div>
<script>
window.pandascripttag = window.pandascripttag || [];
window.pandascripttag.push(function (){
const player = new PandaPlayer('panda-XXXX', {
onReady: () => {
console.log('PLAYER LOADED')
}
})
})
</script>
video_idexpects thevideo_external_idDespite the name, the
video_idoption must receive the video'svideo_external_id(a UUID), andlibrary_idmust receive thepullzone_name. Both values are returned by the Videos API (thevideo_external_idandpullzone_namefields). Using the internal videoidwill break playback.
<div id="panda-XXXX"></div>
<script>
window.pandascripttag = window.pandascripttag || [];
window.pandascripttag.push(function () {
const player = new PandaPlayer('panda-XXXX', {
library_id: 'PULLZONE_NAME', // e.g. vz-6a0bfc2c-30b
video_id: 'VIDEO_EXTERNAL_ID', // the video_external_id (UUID), NOT the internal id
onReady: () => console.log('PLAYER LOADED'),
})
})
</script>Class Methods
| Method name | Rerurn type | Description |
|---|---|---|
| contructor(string,object) | string, { onReady, onError, video_id, library_id, defaultStyle, playerConfigs: {params} } | |
| play() | Play video | |
| pause() | Pause video | |
| togglePlay() | Toggle video play | |
| toggleFullscreen() | Toggle video fullscreen | |
| exitFullscreen() | Exit of fullscreen mode | |
| setCurrentTime(number) | Set video current time (in seconds) | |
| setVolume(number) | Set video volume (0 to 1) | |
| onEvent(function) | Receive events by a callback function | |
| getColors() | object | Get a object with all player colors |
| setSpeed(number) | Set the playback speed (verify avalible options in getSpeed()) | |
| setColor(string,string) | Replace a color in the player using (name, color) params. Check all the avalible options in getColors() | |
| getCurrentTime() | number | Video current time in seconds |
| getDuration() | number | Video duration in seconds |
| isFullscreen() | boolean | Is video in fullscreen |
| getVolume() | Get video volume | |
| isPaused() | boolean | Is video paused |
| isMuted() | boolean | Is video muted |
| isPIP() | boolean | Is video in pic in picture mode |
| hasAudio() | boolean | Has videeo a audiotrack |
| setVolume() | Set a volume to the video | |
| destroy() | Destroy the player element |
Examples
You can find examples for a many of use cases here
