共用方式為


mediaDur Property

This topic documents a feature of HTML+TIME 2.0, which is obsolete as of Windows Internet Explorer 9.

Gets the duration of the element's media file.

Syntax

HTML N/A
Scripting [ iDur = ] object.mediaDur

Possible Values

iDur Integer that receives the media file's duration, in seconds.

The property is read-only. The property has no default value.

Remarks

This property might not be available until the object fires the onmediacomplete event.

Example

This example uses the mediaDur property to get the duration of the media file.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML XMLNS:t ="urn:schemas-microsoft-com:time">
<HEAD>
<TITLE>mediaDur Property</TITLE>
<?IMPORT namespace="t" implementation="#default#time2">

<STYLE>
    .time{ behavior: url(#default#time2);}
</STYLE>
</HEAD>

<BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF"
    LINK="#000000" VLINK="#808080" ALINK="#000000">

<t:video id="m1" style="position:absolute;top:50px;height:100px"
    src="/workshop/samples/author/behaviors/media/shuttle3.wmv" />

<SPAN style="position:absolute;top:165px;" id="mediaDur1">Media duration:</SPAN>

<P style="position:absolute;top:190px;">
<BUTTON id="b1" onclick="mediaDur1.innerText='Media duration: ' + 
    m1.mediaDur + ' seconds'">Click here for media's duration</BUTTON>
</P>
</BODY>
</HTML>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/mediadur.htm

Applies To

t:ANIMATION, t:AUDIO, t:IMG, t:MEDIA, t:PAR, t:REF, t:SEQ, t:VIDEO

See Also

Introduction to HTML+TIME, activeDur, dur, repeatDur, segmentDur, simpleDur, mediaHeight, mediaWidth