Player API

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_id expects the video_external_id

Despite the name, the video_id option must receive the video's video_external_id (a UUID), and library_id must receive the pullzone_name. Both values are returned by the Videos API (the video_external_id and pullzone_name fields). Using the internal video id will 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 nameRerurn typeDescription
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()objectGet 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()numberVideo current time in seconds
getDuration()numberVideo duration in seconds
isFullscreen()booleanIs video in fullscreen
getVolume()
Get video volume
isPaused()booleanIs video paused
isMuted()booleanIs video muted
isPIP()booleanIs video in pic in picture mode
hasAudio()booleanHas 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