Events tracking

JS API allows you to receive events, request data and manage it from the outside.

Enable subscription in the builder Plugins > API > Events tracking

By default, all events will come to the function PlayerjsEvents (you can change the functions name in the settings) with three arguments:

event event name
id player ID
data information data

function PlayerjsEvents(event,id,data){
   if(event == "time"){

You can split the subscription into several functions. To do this, specify the object instead function name


In this example, the play event will come to the onPlay function, and all other events will come to onOther. With PRO you can also add event listeners.

Event Description Returning data
init initialization -
start first playback launching -
play playback starting -
pause playback pausing -
stop playback stopping -
end end of playback -
finish end of playback including advertising -
new launching new source -
time playback time changed time in seconds
duration playback duration changed duration in seconds
seek seeking time in seconds
mute sound is muted -
unmute sound is unmuted -
volume volume is changed volume from 0 to 1 
quality quality is changed name of the current quality
audiotrack audio track is changed name of the current audio track
subtitle subtitle is turned on name of the current subtitle
fullscreen full screen is turned on -
exitfullscreen exit from the full screen mode -
buffering start buffering -
buffered end of the buffering -
error playback error error description
fragment HLS fragment name of the current fragment
height the height of the player has changed value in pixels
playlist playlist loaded -
download used download option -
visibility visibility of the player is changed -
resize resized in normal mode width,height


You can also catch events with listeners (in this case events will not come to PlayerjsEvents). Enable this mode in API options Use listeners


How to listen events of the player, which is located in the iframe

Firstly enable the option  Plugins / API / postMessage for iframe. Events will arrive to the window via message event with a data object.

window.addEventListener("message", function (event) {

More: Commands for managing the player and requests for data retrieval

2020 © PlayerJS


Restore password
Sign up
Log in

Sign up free

Sign up
By signing up, you agree to Terms of Service
Login if you have an account


Your name
Order player

Restore password

Forgot email? Contact us