$title =

Subtitles in a MediaElement

;

$content = [

Loading subtitles to MediaElement in Silverlight is pretty easy but there are some features that you need to be aware of.

You associate a list of subtitles to a MediaElement by adding Markers to the MediaElement.

<MediaElement
    x:Name="MyMediaElement" />

MyMediaElement.Markers.Add(
    new TimelineMarker()
    {
        Text = "xamlgeek made this subtitle",
        Time = TimeSpan.FromMilliseconds(1000)
    });

To display the subtitle on an UI element like a formatted TextBlock you need to subscribe to the MarkerReached event on the MediaElement. This event will be fired when the media reaches the marked on the specified timespan.

MyMediaElement.MarkerReached += (se, ea) =>
    MySubTitleTextBlock = ea.Marker.Text;

But there is one minor problem that you need to be aware of when building more complex media applications. If you add a TimeLineMarker to a MediaElement before the MediaOpened event is fired, the Markers will not trigger the MarkerReached event.

You can take a look at http://sputnik.tv2.dk to see a running media application using subtitles as described above.

by xamlgeek

];

$date =

;

$category =

;

$author =

;

$next =

;