I am creating an embedded Windows Media Player for the web which will have a variety of features useful in our elearning modules. It is supposed to read data from an asx file and use it to generate a menu with buttons, one for each entry in the asx file. I based the scripts on some instructions found on a windows media forum.

To see it working mostly correctly, look at the example link using IE 6 or later.

The example is here:

videowidget

Then look at it in Firefox 1.5 w/ ActiveX plugin installed. The player starts playing the movie, but does not generate any buttons from the asx file entries. It also does not STOP playing the movie, which it should do as soon as the entry buttons are loaded. And I get no error messages in the console.

I believe the issue has something to do with the speed at which the entries are read in Firefox - in other words a timing problem. There is a function called "loadPlayItems()" which sets the player URL to a given asx file, and then starts the player. Apparently there is a sort of bug in WMP where unless the player has actually started playing, the asx file cannot be read.

Code:
function loadPlayItems() {
dp=document.getElementById("chaptersDiv");
WMP9=document.getElementById("mediaPlayer");
WMP9.url="multiItemTest.asx";
WMP9.controls.play();
var pl = WMP9.currentPlaylist;
//alert(pl.sourceURL);
}
loadPlayItems() is executed on page load. After the final HTML tag on the page, I have a script which calls "showPlayItems()". This function loops through all the items on the playlist and for each item, generates a div containing text and a mousedown event which should call the correct clip. Finally, after finishing the loop and rendering all the buttons, the player is shut off, awaiting user input.

function showPlayItems() {
WMP9=document.getElementById("mediaPlayer");
var pl = WMP9.currentPlaylist;
var playlistItems=pl.count;
for (i=0; i<playlistItems; i++) {
var oneLink=(' id=\"btn'+ i +'\" class=\"toggle\" onmouseover=\"on(this.id)\" onmouseout=\"off(this.id)\" onmousedown=\"goTo(this.id, '+ i +')\">'+pl.item(i).name);
dp.innerHTML+=('<div'+oneLink+'</div>');
}
playListLoaded=true;
WMP9.controls.stop();
}[/CODE]

The complete set of files-there are 4 files total:
index.htm
player1.js
videocontrols.js
multiItemTest.asx
videowidget.css

to download the complete file set (644K),
Click this link

Thanks for any assistance!

Ellen