Detecting Markers in SmoothStreamingMediaElement player

Mar 23, 2010 at 9:39 PM
Edited Mar 23, 2010 at 9:56 PM

Hi all,

Hope someone has an answer to my question and that answer is yes this can be done.

I had AdaptiveStreamingSource variable set to point to the manifest file to play the smooth streaming video in MediaElement, which works. If I run myMediElement.Markers.Count, it'll return the number of markers that I know exist in that media file. However this doesn't work for (Core)SmoothStreamingMediaElement player. mySmoothStreamingMediaElement.Markers.Count returns 0. Anybody know why this is happening? I tried to fire MarkerReached event for the <p:Player> element too but to no avail either. Plus it only has e.Marker.Time and e.Marker.Duration (no Text), so not my option anyway.

 

What works: MarkerReached event will be fired and myMediaElement.Markers.Count will return the correct number of markers:

<MediaElement Name="myMediaElement" Grid.Row="0" Grid.Column ="1" Grid.ColumnSpan="5" 
                          AutoPlay="True"  Width="550" Height="288"
                          MediaOpened ="MediaElement_MediaOpened"
                          MarkerReached="MediaElement_MarkerReached"
                          Margin="10" 
                          />

I assign the source in the back code like so:

    AdaptiveStreamingSource src = new AdaptiveStreamingSource();

src.ManifestUrl = new Uri("http://<servername>/<sharedfoldername>/<filename>.ism/Manifest");
src.MediaElement = mySmoothStreamingMediaElement;
src.StartPlayback();

What stinking doesn't work: MarkerReached event won't fire anything. Also, mySmoothStreamingMediaElement.Markers.Count = 0,

<p:Player x:Name="player" Grid.Row="0" Grid.Column ="1" Grid.ColumnSpan="5" Width="512" Height="288"> 
<p:CoreSmoothStreamingMediaElement x:Name="mySmoothStreamingMediaElement" AutoPlay="True" SmoothStreamingSource="http://<servername>/<sharedfoldername>/<filename>.ism/Manifest" MarkerReached="MediaElement_MarkerReached" MediaOpened="MediaElement_MediaOpened"> </p:CoreSmoothStreamingMediaElement>
</p:Player>

 

I want to use the CoreSmoothStreamingMediaElement because it actually is a template. Easier to develop. And yes, it's the same file I used.

 

Thanks in advance!!

 

 
            
             
  

 

Mar 23, 2010 at 10:08 PM

How are you getting markers into your Media Element?

Mar 23, 2010 at 10:10 PM

Using this:

foreach (TimelineMarker marker in myMediaElement.Markers)
{
     //...            
}

 

Mar 23, 2010 at 10:19 PM

I mean, where is your marker data coming from? Where is your marker data source?

Mar 23, 2010 at 10:30 PM

When the Source points to the manifest file (=media file encoded in Expression Encoder 3)

"http://<servername>/<sharedfoldername>/<filename>.ism/Manifest"

, my guess is that it's reading the marker data encoded in that media file. If you watch this tutorial, perhaps it will make more sense.

http://www.silverlight.net/learn/videos/all/handling-media-events/

 

Notice that MarkerReached event fires.

Does this answer your question?

 

Mar 24, 2010 at 5:14 AM
Any thoughts? Please?
Mar 25, 2010 at 3:31 AM

Eric,

I believe you are seeing this behavior due to the differences between SMF's CoreSmoothStreamingMediaElement and Microsoft's MediaElement used with an AdaptiveStreamingSource.

The reason you are seeing this is because SMF's CoreSmoothStreamingMediaElement.Markers collection is completely independent from Microsoft's MediaElement (and even the SmoothStreamingMediaElement that SMF's CoreSmoothStreamingMediaElement is derived from). While Microsoft's MediaElement/AdaptiveStreamingSource may pick up the markers from within the manifest file, the SMF CoreSmoothStreamingElement is designed to be very extensible, so that you can pull in marker data from a variety of static and dynamic sources. It does not appear to automatically import the marker data contained in the manifest.

Take a look at this video for more information on how to use the SMF implementation of Timeline Markers, and pulling the marker data from an outside source.

http://www.silverlight.net/learn/videos/Silverlight-Media-Framework/Creating-Custom-Timeline-Markers/

Hope this helps,
Brandon

Mar 25, 2010 at 4:01 AM

Brandon,

 

Thanks. I've seen that video before. This tutorial teaches to create Customer markers outside of the Encoder, which is not exactly the scenario I was looking for since I already have the encoded video with marker and caption information in the media file. In that case, Expression Encoder is no good for me for meta data. Am I right? That's frustrating :(

Oct 21, 2010 at 8:32 PM
Edited Oct 21, 2010 at 9:29 PM

With the new released binaries I am seeing the Markers being imported that are contained in the Manifest. Media files are being encoded with EE4 Pro. Don't know if thats an unknown feature or has been added as a new feature. New features list does not indicate that its available. I do see the TimelineMarkerReached, left and skipped events firing correctly with Marker info.