Partager via


activeTrack Property

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

Sets the active track or gets the active playItem object in the playList collection.

Syntax

[ oPlayItem = ] playList.activeTrack

Possible Values

vTrack Specifies the active track.
oPlayItem Receives the active playItem object in the playList collection.

The property is read/write. The property has no default value.

Remarks

When you use this property to set the active track in the playList, that track begins playing immediately.

If a script accesses this property on a playList that is not currently active, an error is returned. To prevent this error, the script should check the isActive property before attempting to read the activeTrack.

Example

This example demonstrates how to retrieve a property of the current active track by using the activeTrack property.

<HTML XMLNS:t="urn:schemas-microsoft-com:time">
<HEAD>
<?IMPORT namespace="t" implementation="#default#time2">
<TITLE>HTML+TIME playList Example</TITLE>

<LINK REL="stylesheet" HREF="/workshop/samples/samples.css" TYPE="text/css">


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

<SCRIPT LANGUAGE="JScript">
function updateBtns()
{
  if (oMedia.currTimeState.isActive) {
    btnStart.disabled=true;
    btnNext.disabled=false;
    btnPrev.disabled=false;
    btnStop.disabled=false;
  }
  else {
    btnStart.disabled=false;
    btnNext.disabled=true;
    btnPrev.disabled=true;
    btnStop.disabled=true;
  }
}

function updateFields()
{
    oTitle.innerText = "Title: " + oMedia.playList.activeTrack.title;
    oAuthor.innerText = "Author: " + oMedia.playList.activeTrack.author;
    oAbstract.innerText = "Abstract: " + oMedia.playList.activeTrack.abstract;
    oCopyright.innerText = "Copyright: " + oMedia.playList.activeTrack.copyright;
    oFilename.innerText = "Filename: " + oMedia.playList.activeTrack.src;
}

function clearFields()
{
  oTitle.innerText = "Title: ";
  oAuthor.innerText = "Author: ";
  oAbstract.innerText = "Abstract: ";
  oCopyright.innerText = "Copyright: ";
  oFilename.innerText = "Filename: ";
}
</SCRIPT>
</HEAD>

<BODY onload="updateBtns()">


<t:MEDIA id="oMedia" src="short_3tracks.asx" begin="indefinite" timeAction="visibility"
onend="updateBtns();" ontrackchange="updateFields();"/>
<P>

<SPAN id="oTitle">Title:</SPAN><BR>
<SPAN id="oAuthor">Author:</SPAN><BR>
<SPAN id="oAbstract">Abstract:</SPAN><BR>
<SPAN id="oCopyright">Copyright:</SPAN><BR>
<SPAN id="oFilename">Filename:</SPAN><BR><BR>

<BUTTON id="btnStart" 
  onclick="oMedia.beginElement(); updateBtns();">
  Start
</BUTTON>

<BUTTON id="btnPrev"
  onclick="oMedia.playList.prevTrack();">
  Previous Track
</BUTTON>

<BUTTON id="btnNext" 
  onclick="oMedia.playList.nextTrack();">
  Next Track
</BUTTON>

<BUTTON id="btnStop"
  onclick="oMedia.endElement(); clearFields();">
  Stop
</BUTTON>

</BODY>
</HTML>

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

Applies To

playList

See Also

Introduction to HTML+TIME, nextTrack, prevTrack