Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Silverlight
 Server Side Playlists
Silverlight 2
Server Side Playlists
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

For Silverlight, a Server Side Playlist (SSPL) is a sequence of media assets (either audio or video) that allows the server administrators to control the sequence of media viewed by the user. This playlist can be created statically or dynamically. A Server Side Playlist used to serve media to Silverlight can only be used to serve media for streaming (either On Demand or Broadcast streams); it cannot presently be used to serve downloaded media. Silverlight uses .wsx configuration files to specify an SSPL which can then be served to the client via the MediaElement object. Below are some advantages to using an SSPL:

  • Because the server seamlessly switches between the media files in a playlist, you can customize the viewer experience by combining multiple digital media files into what will appear to the end user to be a single content stream. Furthermore, this minimizes bandwidth spikes by decreasing the number of times that clients must connect to retrieve content.

  • When users connect to a live broadcast before it has started, they can have some media to watch that plays in a loop while they wait.

  • You can use the server object to specify dynamically what media files to stream. In other words, you can edit the playlist even while a client is viewing a stream identified by the playlist.

  • You can gain additional control over playback of your media. For example, you can specify that a video file begins playing 30 seconds into the video clip and ends 10 seconds later. Another example is that you can specify that a certain video is played if another video fails to load.

To use a Server Side Playlist in your Silverlight application, you must first create a .wsx file on your server, publish it, and then connect your client (via MediaElement) to the published stream that represents the .wsx file.

Note:

Presently, MediaElement does not support all the tags and functionality offered by .wsx files. See Integrate Playlist into Silverlight for more details.

A .wsx file is an XML file that defines what you want your playlist to contain and how it should behave. A simple .wsx file below specifies three media files to be played, one after the other.

<?wsx version="1.0"?>
<smil>
  <seq id="sq1">
   <media id="video1" src="clip1.wmv" />
   <media id="video2" src="clip2.wmv" />
   <media id="video3" src="clip3.wmv" />
  <seq>
</smil>

There are a variety of tags supported by .wsx files enabling greater control over media playback than simply playing one video after the other. For example, you can use the clipBegin and clipEnd tags to serve up a sub-clip of a video.

...
   <media id="video1" src="clip1.wmv" clipBegin="15s" clipEnd="30s" />
...

Below is a list of playlist elements and attributes supported by Silverlight.

Note   Unsupported attributes might work. They are presently listed as unsupported because they have not been fully tested for Silverlight Beta 2.

Element & Description

Supported Attributes

Unsupported Attributes

Smil - The root of the playlist.

id, repeatDur, dur, repeatCount

begin, end, syncEvent

Switch - Wraps a series of items and allows the server to switch between them if access to one of the items fails.

id

syncEvent

Media - Defines an audio or video file in the playlist.

dur, id, repeatCount, repeatDur, role, src (only streaming video or audio)

clipBegin, clipEnd, begin, end, syncEvent, mediaName

noSkip is always set to true.

You can only point to an audio or video file with the src attribute.

Excl - A time container in which only one media element can be played at a time, but the order in which the elements are played is not restricted.

dur, id, repeatCount, repeatDur

begin, end, endSync, syncEvent

Seq - A time container that forces media elements within it to play in the order in which they appear within the seq element.

dur, id, repeatCount, repeatDur

begin, end, endSync, syncEvent

Once you have created your playlist file, you may have to configure your server to work with playlists - specifically, add the MIME type for .wsx files.

To play media in your Silverlight application, reference you playlist file using the MediaElement. The .wsx file will be used on Windows Media Services (WMS) as source of the On-demand/broadcast publishing point, so for example if the .wsx file is sample_playlist.wsx and the publishing point is Server:8081/samplePlaylist, then the MediaElement definition would be something like:

...
   <MediaElement Source="mms:// Server:8081/samplePlaylist" />
...

There are a number of things to keep in mind when using MediaElement with a Server Side Play List:

  • MediaOpened event: This event is raised every time the playlist changes entries, in other words, every time a new piece of media in the playlist starts playing.

  • MediaEnded event: This event does not occur when the playlist changes entries, rather, it only occurs after the playlist has completed playing back the entire stream.

  • Pause method/ CanPause property: For SSPLs presented as a live stream, CanPause is always false and calling the Pause method does nothing. For SSPLs presented as on-demand content, CanPause is true and the content can be paused at the given frame.

  • Stop method: For SSPLs presented as a live stream, calling the Stop method stops playback. When play is pressed again, the stream picks up wherever the playlist is currently. For SSPLs presented as on-demand content, calling Stop stops playback. When play is pressed again, the stream begins at the first entry in the playlist.

  • Seeking behavior/ CanSeek: Seeking is not supported for either on-demand or broadcast streams in Silverlight 2. CanSeek always returns false if given a SSPL.

  • Not All Media Supported: Because you are playing media served by the SSPL via a MediaElement, only media supported by MediaElement can be used (audio and video).

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker