
getPlaylistItem().index -> undefined
Hello
I've two problems, both of which are most likely Javascript issues and not JWPlayer issues, but I hope you can nevertheless give me hints.
What I'm trying to achieve is to read the index number of the current item from playlist being played.
In my Javascript I have a global variable for the player
bc.. var videoPlayer;
The init() function is invoked by the onload event of the document and initializes the player (clipInfos is an array with playitems) and a timer invoking the function updateAll is bound to the play state:
bc.. function init() {
videoPlayer = new jwplayer("videoPlayerArea");
videoPlayer.setup({ playlist : clipInfos,
listbar : { position: 'bottom' , size : 120},
events: { onPlay : function() {updateTimerActive = setInterval(updateAll, 1000);},
onPause : function() {clearInterval(updateTimerActive);} }
});
...
}
Up to here everything works as intended.
Now in this function updateAll() I want, besides other things, get the index of the item currently played Listitem and the position.
Therfore I try this:
bc.. function updateAll() {
time=videoplayer.getPosition();
playlistindex=videoplayer.getPlaylistItem().index;
...
}
But this fails in two ways:
1. the reference to the global var videoplayer is not resolved, instead I only get the player position when replacing videoplayer. by jwplayer().
2. after doing so playlistindex=jwplayer().getPlaylistItem().index always returns "undefined"
Any ideas?
Best regards
Markus