Basically I want to be able to control a menu through JS by highlighting the current video.
But I need to be able to get the value of the current playlist item.
I have looked at the API/js pages and tried looking around the site/google searchs and can't seem to figure this out.
The only thing I've seen that comes close to this is a player command: playlistItem(i:Number)
I havn't been able to get anywhere with it but it seems like that tells the player to play that list item.
How can I get the current number in list? (I'm using an XML file for a playlist).
Thanks,
Justin
Sorry, I should of posted the code I have:
JS:
var currentState = "NONE";var player = null;
function playerReady(thePlayer) {
player = document.getElementById(thePlayer.id);
addListeners();
}
function addListeners() {
if (player) {
player.addModelListener("STATE", "stateListener");
} else {
setTimeout("addListeners()",100);
}
}
function stateListener(obj) { //IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED
currentState = obj.newstate;
//when something finishes------------------
if ((currentState == "COMPLETED")) {
alert(currentItem);
}
}
function createPlayer() {
var flashvars = {
file:"playlist.xml",
repeat:"list",
autostart:"true"
}
var params = {
allowfullscreen:"true",
allowscriptaccess:"always"
}
var attributes = {
id:"player1",
name:"player1"
}
swfobject.embedSWF("player.swf", "jwplayer", "720", "480", "9", false, flashvars, params, attributes);
//swfobject.js = swfobject 2.2 (version)
}