How TimelineMarkers are working??

Aug 23, 2010 at 9:58 AM

Hi all,

I'm trying to build a timecoded player based on SMF V2.1 (smooth streaming and wmv streams). I've followed the guidelines from MSDN ( but it failed.

In my project, I've a list of timespans, corresponding of a set of time code. At start of the application, I'm populating the SMF player (in the override OnApplyTemplate() function) TimelineMarkers function with TimelineMediaMarkers elements as the following :

            int x = 0;
            foreach (BroadcastClasses.ChapterItem chptItem in App._chapterObj.CHAPTER_LIST)
                TimelineMediaMarker tlMarkItem = new TimelineMediaMarker();
                tlMarkItem.Begin = TimeSpan.Parse(chptItem.CHAPTERITEM_POSITION);
                tlMarkItem.AllowSeek = true;
                tlMarkItem.Id = "chpt" + x;
                tlMarkItem.Type = "chpt";


Nevertheless, when calling the TimelineMarkersReached() function, that doesn't work for smooth streming stream and that's working in a very strange manner for WMV stream.


Why using TimelineMarkers? Looking at this MSDN page :, Extract Timeline Events and assign Markers section, it says that we have to access the StreamInfo for retrieving the markers from the manifest (that doesn't apply to our project cause the markers are in a separated list coming from a webservice) and then assign the markers to the chunks using

    private void AddMarkers(IAsyncResult argAR)
        if (!Deployment.Current.Dispatcher.CheckAccess())
            Deployment.Current.Dispatcher.BeginInvoke(() => AddMarkers(argAR));

        foreach (SegmentInfo segmentInfo in SmoothPlayer.ManifestInfo.Segments)
            foreach (StreamInfo streamInfo in segmentInfo.SelectedStreams)
                if (streamInfo.UniqueId == ((string)argAR.AsyncState))

                    List<ChunkInfo> markerChunks = streamInfo.ChunkList.ToList<ChunkInfo>();

                    foreach (TrackInfo trackInfo in streamInfo.SelectedTracks)
                        ChunkResult chunkResult = trackInfo.EndGetChunk(argAR);

                        if (chunkResult.Result == ChunkResult.ChunkResultState.Succeeded)
                            System.Text.Encoding enc = System.Text.Encoding.UTF8;
                            int length = (int)chunkResult.ChunkData.Length;
                            byte[] rawData = new byte[length];
                            chunkResult.ChunkData.Read(rawData, 0, length);
                            String text = enc.GetString(rawData, 0, rawData.Length);
                            TimelineMarker newMarker = new TimelineMarker();
                            newMarker.Text = text;
                            newMarker.Time = chunkResult.Timestamp;


Unfortunatelly, SmoothPlayer (or the extended SMF player) is not handling and managing any Markers() function, meaning that we can't use SmoothPlayer.MArkers.Add(newMarker). Moreover, the delegate method SmoothPlayer.MarkersReached doesn't exist.

That's why I'm using TimelineMarkers. But that's not the "graal" : it's not working with smooth streaming and as I said, WMV streams semms strange sing the onReached delegate is activated every second (even if you have only one TimelineMediaMarker Element)

What I have to do and use for having a set of chapters and/or timecoded events which will work for smoothstreaming and wmv?


Thanks a lot


Aug 25, 2010 at 5:36 PM

Any idea on that?