Поделиться через


nextTrack method

Advances the media-playing container to the next playItem object in the playList collection and begins playing that track.

Syntax

var retval = playList.nextTrack();

Parameters

This method has no parameters.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Using this method on the last track causes the playList to stop playing tracks. If the element has a repeatCount greater than 0, the next repeat iteration begins.

Examples

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

<HTML XMLNS:t="urn:schemas-microsoft-com:time">
<HEAD>
<TITLE>nextTrack and prevTrack Methods</TITLE>
<?IMPORT namespace="t" implementation="#default#time2">

<STYLE>
    .time{ behavior: url(#default#time2);}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
function updateBtns() {        
    if(m1.currTimeState.isActive){
        b0.disabled=true;
        b1.disabled=false;
        b2.disabled=false;
        b3.disabled=false;
    }else{
        b0.disabled=false;
        b1.disabled=true;
        b2.disabled=true;
        b3.disabled=true;
    }
}
function updateFields(){
    title1.innerText = 'Title: ' + m1.playList.activeTrack.title;
    author1.innerText = 'Author: ' + m1.playList.activeTrack.author;
    abstract1.innerText = 'Abstract: ' + m1.playList.activeTrack.abstract;
    copyright1.innerText = 'Copyright: ' + m1.playList.activeTrack.copyright;
}
function emptyFields(){
    title1.innerText = 'Title: ';
    author1.innerText = 'Author: ';
    abstract1.innerText = 'Abstract: ';
    copyright1.innerText = 'Copyright: ';
}
</SCRIPT>
</HEAD>

<BODY onload="updateBtns()" TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED"
    BGCOLOR="#FFFFFF" LINK="#000000" VLINK="#808080" ALINK="#000000">
...
<t:media id="m1" begin="0;indefinite;"
    src="/workshop/samples/author/behaviors/media/media.asx"
    onmediacomplete="updateFields();updateBtns();"/>

<span id="title1">Title:</span><BR>
<span id="author1">Author:</span><BR>
<span id="abstract1">Abstract:</span><BR>
<span id="copyright1">Copyright</span><BR><BR>

<BUTTON id="b0" onclick="m1.beginElement();updateFields();updateBtns();">
    Start</BUTTON>
<BUTTON id="b1" onclick="m1.playList.nextTrack();updateFields();">
    Next Track</BUTTON>
<BUTTON id="b2" onclick="m1.playList.prevTrack();updateFields();">
    Previous Track</BUTTON>
<BUTTON id="b3" onclick="m1.endElement();emptyFields();updateBtns();">
    Stop</BUTTON>
</BODY>
</HTML>

See also

playList

Reference

activeTrack

prevTrack

Conceptual

Introduction to HTML+TIME