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>

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