This is a migrated thread and some comments may be shown as answers.

ChapterReached Event

7 Answers 50 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
Scott Laughton
Top achievements
Rank 1
Scott Laughton asked on 09 Mar 2009, 10:46 AM
Hi there,
        I am wanting to update a panel with relevant content at specific points of time as the video is playing.  I thought to do this, I would add some chapters to a MediaItem, and add some logic to the ChapterReached event to detect what chapter had just ended and take the appropriate action.  However I do not want the chapter title to appear on the video, and there seems to be no reliable way to know what chapter raised the event.  I set the chapters Position property to "00:00:10" and then when I check the MediaElementCurrentTime property in the ChapterReached event, sometimes it is "00:00:10" and sometimes it is "00:00:09".  I can't use the ChapterTitle property as that shows on the video and I don't want that.  So what is a reliable way to detect what chapter raised the ChapterReached event?

BTW:
Here is my setup:
 - RadControls for Silverlight 2008 3 1217
 - Microsoft Visual Studio 2008 Version 9.0.30729.1 SP
 - Microsoft .NET Framework Version 3.5 SP1
 - Windows XP Pro x64

Regards,

    Scott.

7 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 12 Mar 2009, 03:10 PM
Hi Scott Laughton,

You can use the Tag property to detect what chapter threw the event.

Hope this helps.

Regards,
Miroslav Nedyalkov
0
Scott Laughton
Top achievements
Rank 1
answered on 13 Mar 2009, 02:49 AM
Miroslav,
    Thanks for the reply.   I did see that the Chapter element had a Tag property, but could not see how locate the current chapter object from inside the ChapterReached event to see what the value of the Tag property on the current chapter was.  Can you provide a sample of how to do this?

Regards,

    Scott.
0
Miroslav Nedyalkov
Telerik team
answered on 13 Mar 2009, 10:03 PM
Hi Scott Laughton,

I investigated the problem and found out that there is no good way to get the current chapter object. We put this in our tasks list for the SP1. There is workaround that is doing the job. You can use the following method to get the current RadMediaChapter object and after that you can use it as you need to:

        public static RadMediaChapter GetCurrentChapter(RadMediaPlayer player) 
        { 
            TimeSpan currentPosition = player.MediaElement.Position; 
            RadMediaItem currentItem = player.CurrentItem; 
            if (currentItem == null
            { 
                return null
            } 
 
            RadMediaChapter currentChapter = null
 
            foreach (RadMediaChapter chapter in player.ChildrenOfType<RRadMediaChapter()) 
            { 
                TimeSpan chapterPosition = TimeSpan.Parse(chapter.Position); 
                if (chapterPosition <= currentPosition) 
                { 
                    currentChapter = chapter; 
                } 
            } 
 
            return currentChapter; 
        } 


Regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Scott Laughton
Top achievements
Rank 1
answered on 17 Mar 2009, 04:00 AM
Miroslav,
        Thanks for the reply, however you workaround incures the problem outlined in my original post:

"I set the chapters Position property to "00:00:10" and then when I check the MediaElementCurrentTime property in the ChapterReached event, sometimes it is "00:00:10" and sometimes it is "00:00:09"."

How long till SP1 is available?

Regards,

    Scott.
0
Accepted
Miroslav Nedyalkov
Telerik team
answered on 18 Mar 2009, 07:25 AM
Hello Scott Laughton,

Yes, I noticed it is not showing the exact time, but you can easily guess which chapter just begun by using this code. If you don't think it is reliable enough, you can find the nearest position and this will be the chapter that invoked the event. Most probably the SP1 will be released within a month.

Regards,
Miroslav Nedyalkov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Eralp Pinardag
Top achievements
Rank 1
answered on 18 Nov 2009, 05:22 PM
I am using 2009/Q3 and still have the same problem defined here. Was this feature ever added? I don't see how to reference the RadMediaChapter reached so I can use the "Tag" property. Please update. Thanks...

Eralp
0
Kiril Stanoev
Telerik team
answered on 19 Nov 2009, 02:39 PM
Hi Eralp,

I have posted an answer to you support ticket. Have a look at it and if you have additional question, let me know.

Best wishes,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
MediaPlayer
Asked by
Scott Laughton
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Scott Laughton
Top achievements
Rank 1
Eralp Pinardag
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Share this question
or