Skip to content

Player Created Callback

giannif edited this page Dec 16, 2014 · 1 revision

You can push callbacks into the _pjsPlayerReady array and they will fire for every new player that's created. This gives you nice decoupling.

var _pjsPlayerReady = _pjsPlayerReady || [];
_pjsPlayerReady.push(function(player){
    // I didn't create this player, but I can still tie into events.
    player.on("stateChange",function(event){});
    });
});

_pjsPlayerReady is a global variable, be sure not to override it.

Clone this wiki locally