我正面临着 jwplayer api 并且我想获得一些事件,但是我的页面中会有多个玩家,所以当我收到一个事件时,我需要知道哪个玩家正在触发该事件。
类似于 youtube api 的东西:
function onPlayerReady(event) {
n = event.target.id - 1; //The index of the player which fire the event
}
但在 jwplayer 我不知道该怎么做:
//PARA TODOS LOS REPRODUCTORES
for (var i = 0; i < videos.length; i++) {
var id = videos[i];
jwplayer(id).setup({
file: "http://content.bitsontherun.com/videos/lWMJeVvV-364767.mp4",
events: {
onReady: function(ev) {
alert('ha iniciado el reproductor '+INDEX OF THE PLAYER WHICH FIRE THE EVENT);
},
onComplete: function(ev) {
alert('ha finalizando el reproductor '+INDEX OF THE PLAYER WHICH FIRE THE EVENT);
}
}
});
}