Compartir a través de


Specifying Interrupt Behavior

You can use multiple priorityClass elements to specify how media elements can be interrupted. In the following example, the values assigned to the attributes in the first priorityClass, peers and lower, indicate that each media element is stopped when another media element in the same block starts, but that no media element is stopped for a lower priority class. In the second priorityClass, the value assigned to the peers attribute indicates that media elements in this class are deferred for elements in higher priority classes. In the third priorityClass, the value assigned to the higher attribute indicates that media elements in this class are paused for elements in higher priority classes but that they will resume playing where they paused when the higher priority elements are finished. The elements in the playlist are played in the following order. Assume that the actual length of the files audio1.wmv to audio5.wmv is 30 seconds each and that the actual length of audio6.wmv is 60 seconds.

  1. p3-m1 starts and runs for 30 seconds of its 60-second length. Then it pauses for higher priority elements.

  2. p2-m1 interrupts and runs for 30 seconds.

  3. p2-m2 is deferred because of the peers="defer" attribute for p2. Therefore, p2-m2 starts when p2-m1 ends and runs for 30 seconds.

  4. p1-m1 starts when p2-m2 ends and runs for 20 seconds. It is stopped by its peer, p1-m2, because the value "stop" is assigned to the peers attribute.

  5. p1-m2 interrupts p1-m1 and runs for 30 seconds.

  6. p3-m1 resumes play and runs until it plays for a total of 60 seconds.

<?wsx version="1.0"?>
<smil>
  <excl>
    <priorityClass id="p1" peers="stop" lower="never">
        <media id="p1-m1" src="c:\wmpub\wmroot\audio1.wma" 
             begin="p2-m2.end" />
        <media id="p1-m2" src="c:\wmpub\wmroot\audio2.wma" 
             begin="p1-m1.begin + 20" />
    </priorityClass>

    <priorityClass id="p2" peers="defer">
        <media id="p2-m1" src="c:\wmpub\wmroot\audio3.wma"
             begin="p3-m1.begin + 30" dur="30" />
        <media id="p2-m2" src="c:\wmpub\wmroot\audio4.wma"
             begin="p2-m1.begin" dur ="30" />
        <media id="p2-m3" src="c:\wmpub\wmroot\audio5.wma"
             begin="p1-m2.begin + 15"/>
    </priorityClass>

    <priorityClass id="p3" higher="pause">
        <media id="p3-m1" src="c:\wmpub\wmroot\audio6.wma"
             begin="0" dur="60" />
    </priorityClass>

  </excl>
</smil>

See Also

Concepts

Attribute Time Formats

Using XML to Define Playlists