Hi,
I am trouble getting the player to load from a link and a playlist using the player.sendEvent('LOAD') command: I have been successfully used the sendEvent command to run properly so I am hoping for a really easy solution:
I can load a the same link using flashvars but not sendevent(LOAD).
here is my code:
<head>
<title>JW WRK 5</title>
<script type="text/javascript" src="http://www.zebamay.com/dev001/mediaplayer4_4/swfobject.js"></script>
<script type="text/javascript">
var currentState = "NONE";
var previousState = "NONE";
var player = null;
function playerReady(thePlayer) {
player = document.getElementById(thePlayer.id);
addListeners();
addViewListener();
}
function addListeners() {
if (player) {
player.addModelListener("STATE", "stateListener");
} else {
setTimeout("addListeners()",100);
}
}
function stateListener(obj) { //IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED
currentState = obj.newstate;
previousState = obj.oldstate;
var tmp = document.getElementById("stat");
if (tmp) {
tmp.innerHTML = "current state: " + currentState +
"<br>previous state: " + previousState;
}
if ((currentState == "COMPLETED")&&(previousState == "PLAYING")) {
document.location.href="http://www.jeroenwijering.com/?item=JW_FLV_Media_Player";
}
}
function addAllViewListeners() {
player.addViewListener("STOP", "doNothing"); //{id,client,version}.
player.addViewListener("VOLUME", "doNothing"); //{position,id,client,version}.e.
}
function createPlayer(thePlayer, theFile) {
var flashvars = {
file:'&file=http://scfire-ntc-aa02.stream.aol.com:80/stream/1010/;stream.nsv&type=sound',
autostart:"true"
}
var params = {
allowfullscreen:"true",
allowscriptaccess:"always"
}
var attributes = {
id:"player1",
name:"player1"
}
swfobject.embedSWF("http://www.zebamay.com/dev001/mediaplayer4_4/player.swf", "placeholder1", "320", "196", "9.0.115", false, flashvars, params, attributes);
}
</script>
</head>
<body onload="createPlayer()"
<a href="http://www.jeroenwijering.com/?item=JW_FLV_Media_Player">JW FLV Media Player</a><br>
<br>
<a href="JavaScript:player.sendEvent('PLAY')">play/pause toggle</a><br />
<a href="JavaScript:player.sendEvent('MUTE')">mute/sound toggle</a><br />
<br>
<a href="#" onclick="JavaScript:player.sendEvent('STOP')">stop playing and buffering</a>
<br>
<a href="#" onclick="player.sendEvent('VOLUME', 50)">set absolute volume 50%</a>
<br>
<a href="#" onclick="player.sendEvent('VOLUME', 100)">set absolute volume 100%</a>
<br />
<a href="#" onclick="player.sendEvent('STOP')">Stop</a><p>
<a href="#" onclick="player.sendEvent('STOP');
player.sendEvent('LOAD', '&file=http://scfire-ntc-aa02.stream.aol.com:80/stream/1011/;stream.nsv&type=sound');
">Load from a link </a>
<br>
<a href="#" onclick="player.sendEvent('STOP');
player.sendEvent('LOAD',
'http://content.bitsontherun.com/videos/qyehIiBT.flv');
">load and Play a Video </a>
<br>
<a href="#" onclick="player.sendEvent('STOP');
player.sendEvent('LOAD',
'http://www.zebamay.com/dev001/playlist1/playlist.xml');
">Load and play a Playlist </a>
<br>
<a href="#" onclick="player.sendEvent('STOP');
player.sendEvent('LOAD',
'http://www.zebamay.com/dev001/playlist1/playlist.xml, 1');
">Play track2 of Playlist </a>
<br />
<br />
<div id="placeholder1">
<a href="http://www.adobe.com/go/getflashplayer">Get flash</a> to see this player
</div>
<br>
<div id="stat"></div>
</body>
</html>
Any help on getting these 3 issue resolved would really help getting further along.
Thanks,

See: http://developer.longtailvideo.com/trac/wiki/FlashEvents#Viewevents
You have an extra parameter "1" after the playlist URI.
player.sendEvent('LOAD','http://www.zebamay.com/dev001/playlist1/playlist.xml, 1');
Better:
player.sendEvent('LOAD','http://www.zebamay.com/dev001/playlist1/playlist.xml');
Wrong format in this code.
player.sendEvent('LOAD', '&file=http://scfire-ntc-aa02.stream.aol.com:80/stream/1011/;stream.nsv&type=sound');Better:
player.sendEvent('LOAD', {'file':'http://scfire-ntc-aa02.stream.aol.com:80/stream/1011/;stream.nsv', 'type':'sound'});