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

MediaEnded not firing

2 Answers 205 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 16 Apr 2010, 06:27 PM
I have what I hope is a simple problem. I'm using the RadMediaPlayer to show a video. When a user gets through the video, I want to record that fact to the database. For whatever reason, my code never fires. Here's my code:

private void PlayVideo(string url, string title) 
        { 
            var item = new RadMediaItem { Source = new Uri(url, UriKind.RelativeOrAbsolute), Title = title }; 
            player.Items.Clear(); 
            player.AutoPlay = true
            player.MediaEnded += PlayerMediaEnded; 
            player.CurrentItem = item; 
            player.Play(); 
        } 


void PlayerMediaEnded(object sender, Telerik.Windows.RadRoutedEventArgs e) 
        { 
            // record to DB, but this never happens 
            Utility.MarkVideoCompleted(); 
        } 


Unfortunately I'm using this in a Azure project, so the debugger spins up the AppFabric and as such it can't be attached to iexplore.exe to investigate. Please help!

2 Answers, 1 is accepted

Sort by
0
Miro Miroslavov
Telerik team
answered on 21 Apr 2010, 01:30 PM
Hello John,

RadMediaPlayer is wrapper around MediaElement, and MediaEnded is raised whenever Silverlight's MediaElement report MediaEnded. You can handle the player.MediaElement.MediaEnded event, but i guess you won't get different result.  I think this could happen because there is something wrong with the encoding of the Video you use. If you can send us example video, we can try to find the problem.

All the best,
Miro Miroslavov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
birbilis
Top achievements
Rank 1
answered on 04 Apr 2013, 12:20 AM
see http://answers.flyppdevportal.com/categories/metro/csharpvb.aspx?ID=4af53ba0-906d-4f99-9d70-a91ed7a27c0b

I think a solution might be to set a MediaMarker at the MediaOpened event (can't set one before that event) and use the MediaElement.NaturalDuration there to specify that the marker is at the end. When you get the MarkerReached event for that specific marker you can stop the mediaelement by code
Tags
MediaPlayer
Asked by
John
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
birbilis
Top achievements
Rank 1
Share this question
or