
August 8th, 2006, 05:55 PM
|
|
Registered User
|
|
Join Date: Aug 2006
Posts: 1
Time spent in forums: 32 m 29 sec
Reputation Power: 0
|
|
|
Help - Trying to extract attributes from windows media player asx playlist
Help please
I have windows media player on a page which is playing video files from an asx file on the webserver. The asx file references the actual video files on an mms server.
What I would like to do is extract the attributes from the asx file so that I can use the information on the web page. I have used examples of script from the sdk. It should process the asx file and provide a list of the attributes such as Playlist Title and Track number, Title and link for each track.
What is confusing me is it worked a few times showing all the information but without changing anything it only now show the link to the asx file.
Here is the link the the media player page media player test page. If it works the first time then it probably wont work if refreshed or reloaded.
HTML Code for testplayer.html
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body onload="onLoad()">
<object classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" width="320" height="240" id="mediaPlayer">
<param name="url" value="ttmtv1.asx" />
</object>
<textarea name="textarea" cols="50" rows="15" id="myText">
</textarea>
<SCRIPT language="javascript">
function onLoad() {
var player = document.getElementById('mediaPlayer');
var display;
var pl = player.currentPlaylist;
display = pl.attributeCount + " Playlist Attributes:\r\r";
for (var i = 0; i < pl.attributeCount; ++i) {
display = display + pl.attributeName(i) + ": ";
display = display + pl.getItemInfo(pl.attributeName(i)) + "\r";
}
for (var j = 0; j < pl.count; ++j) {
display = display + "\rTrack " + j + "\r"
display = display + pl.item(j).attributeCount + " Attributes:\r\r";
for (var k = 0; k < pl.item(j).attributeCount; ++k) {
var it = pl.item(j); // Media object
display = display + it.getAttributeName(k) + ": ";
display = display + it.getItemInfo(it.getAttributeName(k)) + "\r";
}
}
document.getElementById('myText').value = display;
}
</SCRIPT>
</body>
</html>
and this is the contents of the asx file
Code:
<ASX VERSION="3.0">
<TITLE>ttmtv</TITLE>
<ENTRY>
<title>The Delta</title>
<REF HREF="mms://85.133.32.11/ttmtv/The%20Delta_1000k.wmv"/>
</ENTRY>
<ENTRY>
<title>Borderline Carpets</title>
<REF HREF="mms://85.133.32.11/ttmtv/DLTV/Borderline%20Carpets_1000k.wmv"/>
</ENTRY>
<ENTRY>
<title>Discover Crete</title>
<REF HREF="mms://85.133.32.11/ttmtv/Discover%20Crete_1000k.wmv"/>
</ENTRY>
<ENTRY>
<title>Paris Montage</title>
<REF HREF="mms://85.133.32.11/ttmtv/Paris%20Montage_1000k.wmv"/>
</ENTRY>
</ASX>
Thanks in advance
Roger.
|