activeTrack Property (playList)

HTML (DHTML)

activeTrack Property

Internet Development Index

Sets or retrieves the track, or playItem object, that is currently active in the playList collection.

Syntax

playList.activeTrack [ = oPlayItem ]

Possible Values

oPlayItem Object that specifies or receives the name of the track, or playItem object, that is currently active in the playList collection.

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

Remarks

Using this property to set the active track in the playList causes that track to begin 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 element's isActive property before attempting to read the activeTrack.

Example

This example demonstrates how to retrieve a property of the currently active track 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="../../common/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>
This feature requires Microsoft?Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This property is a Microsoft extension to Synchronized Multimedia Integration Language (SMIL) Non-Microsoft link.

Applies To

playList

See Also

Introduction to HTML+TIME, nextTrack, prevTrack