JScript - tilgå attributten FileSize i multimedie?
Understående henter alle værdier for tilgængelige attributter ud af et medie og virker storartet. Fint nok, men hvordan får jeg alene værdien for 'FileSize' hevet ud ?Ref.:
FileSize:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay/mmp_sdk/availableattributes.asp
Kodeeksempel:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay/mmp_sdk/availableattributes.asp
<HTML>
<HEAD>
<TITLE>Retrieve Attributes Sample</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD WIDTH="50%"><CENTER>
<OBJECT ID="player"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<PARAM NAME="autoStart" VALUE="True">
<PARAM NAME="URL" VALUE="en_video_film.wmv">
</OBJECT><BR><BR>
<INPUT TYPE="button" ID="btnShowAttribs" NAME="btnShowAttribs"
VALUE="Show Attributes" onClick="showAttribs()"></CENTER>
</TD>
<TD WIDTH="50%"><CENTER>
<TEXTAREA ID="txtAttribs" NAME="txtAttribs" COLS="50" ROWS="20">
</TEXTAREA></CENTER>
</TD>
</TABLE>
<SCRIPT LANGUAGE="JScript">
<!--
function showAttribs()
{
var numAttribs = 0;
var attribName = "";
var numInstances = 0;
var attribValue = "";
var oMedia = player.currentMedia;
// Clear the TEXTAREA element first.
txtAttribs.value = "";
// Retrieve the number of attributes for the item.
numAttribs = oMedia.attributeCount;
for (var i = 0; i < numAttribs; i++){
// Retrieve the name of this attribute.
attribName = oMedia.getAttributeName(i);
// Retrieve the number of values for this attribute.
numInstances = oMedia.getAttributeCountByType(attribName, "");
try {
// Retrieve each value for this attribute.
for (var j = 0; j < numInstances; ++j) {
attribValue = oMedia.getItemInfoByType(attribName, "", j);
txtAttribs.value += attribName + " -- " + attribValue + "\n";
}
}
catch(err) {
alert(err.description);
}
}
}
-->
</SCRIPT>
</BODY>
</HTML>
