Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-16-2006, 09:10 PM   PM User | #1
EllenM1
New Coder

 
Join Date: May 2003
Location: MI
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
EllenM1 is an unknown quantity at this point
Windows Media web interface problem

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
EllenM1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:19 AM.


Advertisement
Log in to turn off these ads.