About playlist syntax

Playlists are based on Extensible Markup Language (XML). One of the advantages of using the Windows Media Playlist Editor to create and edit playlists is that you do not need to know XML code. However, if you are familiar with XML, you can create or modify playlist files by using a text editor such as Notepad. After you add all the items to your playlist, the Playlist Editor automatically transforms your playlist into a SMIL 2.0-based XML document. Keep in mind that the changes or additions you make to the playlist do not take effect you save the file.

The following illustration compares how a sample playlist file, Serverside_Playlist.wsx, appears when opened in a text editor versus how it looks when opened in Windows Media Playlist Editor. Serverside_Playlist.wsx is provided by default with Windows Media Services.

A playlist file is made up of seven basic Extensible Markup Language (XML) elements: smil, media, seq, switch, excl, priorityClass, and clientData. An element can either contain information about the element or control the behavior of one or more other elements. By arranging these elements and setting values for their corresponding attributes, you can determine the playback and presentation structure of a playlist.

The organization of the playlist elements defines the playlist's control structure. For example, if you open a playlist in a text editor, you will notice that some playlist elements are enclosed within other playlist elements. Elements that contain other playlist elements are known as parent elements. A parent element controls the behavior of all the elements within it, known as the child elements.

Six of the seven basic XML playlist elements act as parent elements: smil, seq, excl, media, priorityClass, and switch. The seq and excl elements act as time containers, meaning that they control the timing of child elements. The priorityClass and switch elements act as control containers, meaning that they control the interaction of child elements.

The following example shows two media elements contained inside a seq element.

<seq>
    <media src="File3.wmv"/>
    <media src="File4.wmv"/>
</seq>

The function of a seq element is to stream the elements that are contained within it in order. Therefore, in the previous example, File3.wmv will play first, followed by File4.wmv. This arrangement of elements contained within other elements is called nesting.

In a playlist, the smil element is the document root, meaning that it is the parent of all the other elements in the playlist. In the following example, a seq element is the child the smil element. The seq element contains media and clientData elements, which are modified by src and title attributes, respectively. The wsx element preceding the smil element is used to identify the version of the server-side SMIL syntax being used.

<?wsx version='1.0'?>
<smil>
    <seq>
        <media src="file1.wmv">
            <clientData title="My File #1"/>
        </media>
        <media src="file2.wmv">
            <clientData title="My File #2"/>
        </media>
        <media src="file3.wmv">
            <clientData title="My File #3"/>
        </media>
        <media src="File4.wmv"/>
            <clientData title="My File #4"/>
        </media>
    </seq>
</smil>

After you understand the playlist elements and their attributes, you will be able to construct many creative solutions for presenting your digital media content. For more information about playlist elements and attributes, see the Windows Media Services SDK Playlist Reference.

Note

If you are creating or editing server-side playlists using either a text editor or an automated script, make sure that you list the playlist elements and attributes in the correct case. XML is a case-sensitive language, and Windows Media Services does not recognize any playlist elements or attributes that are not listed properly.

Note

If your playlist includes JPEG image files, do not include any syntax in your playlist that would cause the image to pause while rendering on the client's computer. Pausing a JPEG image in this manner can cause the player to enter a permanent wait state. If you must show a still image under these circumstances, create a video file of that image and then use the video file in the playlist instead.

Note

If your playlist includes JPEG image files and you are using the playlist file with a broadcast publishing point, be aware that users who connect to the broadcast while the JPEG image is being streamed will not receive the image. They will instead see a black screen. After the playlist continues on to the next item, playback will continue as expected. If you want a JPEG image to be displayed for a certain period of time, you should use the repeatCount attribute to repeat the image for short durations that together equal the amount of time that the image is to be displayed. That way, players that connect while the image is being streamed can receive the image when it repeats. For example, if a JPEG image is to be displayed for 60 seconds, you could set a dur attribute value of five seconds and a repeatCount attribute value of 12. If a user connects two seconds into the broadcast, the image would be displayed after three seconds. If the repeatCount and dur attribute values were not used, the user would see a black screen for 58 seconds.

See Also

Other Resources

Windows Media Services SDK Playlist Reference