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

Forward, Rewind Buttons & Methods

4 Answers 214 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
Greg S
Top achievements
Rank 1
Greg S asked on 17 Oct 2008, 10:45 PM
Is there a way to programatically "fast forward" or "rewind" the media being played?  There are Next/Previous Chapter/Movie methods, but it doesn't seem that there is a way to traverse the current file without creating Chapters in 1 second increments. 

It would be nice if there was a .Skip method that accepted a integer for the number of seconds (positive or negative) to move from the current position.

.Skip(-10) would move back 10 seconds from the current position in the media file, while .Skip(10) would move ahead 10 seconds. 

I'm not stuck on this particular implementation and perhaps there is a way to accomplish this now, but any feedback would be appreciated.

Thanks,

Greg

4 Answers, 1 is accepted

Sort by
0
Accepted
Kiril Stanoev
Telerik team
answered on 19 Oct 2008, 12:21 PM
Hello Greg,

In its implementation RadMediaPlayer uses a MediaElement, to play a movie for example. Implementing fast-forward and rewind is not an easy task. Currently the only way to achieve it is to set the Position property of the MediaElement. And if you're streaming, you'll quickly run out of buffer, at which point it becomes a slideshow punctuated by picture and sound snippets.

See this forum thread.

However, if you want to try it for yourself, RadMediaPlayer exposes its MediaElement through the MediaElement property.
Therefore, to go to the 10th second of a particular movie, you should do like the following:
(radMediaPlayer1 being an instance of RadMediaPlayer)
// Overloaded constructor takes the arguments days, hours, minutes, seconds, miniseconds.  
TimeSpan ts = new TimeSpan(0, 0, 0, 10, 0);  
radMediaPlayer1.MediaElement.Position = ts;  

If you have any additional questions, do not hesitate to contact us.

Kind regards,
Kiril Stanoev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Greg S
Top achievements
Rank 1
answered on 20 Oct 2008, 03:04 PM
Kiril,

This is exactly what I needed.  I didn't realize I had access to the MediaElement from the control, but it makes perect sense. 

I simply used the .Add method on the TimeSpan object to move the position in 5 second increments.  

//fast foward
myMediaPlayer.MediaElement.Position = myMediaPlayer.MediaElement.Position.Add(

new TimeSpan(0, 0, 5));

 

//rewind
myMediaPlayer.MediaElement.Position = myMediaPlayer.MediaElement.Position.Add(

new TimeSpan(0, 0, -5));

 

0
kalyan
Top achievements
Rank 2
answered on 30 Dec 2008, 10:11 AM
Hi,
 telrik team. The methods for forwarding and rewinding the MediaItem is not an issue. There is no Forward or Rewind button provided in this RadMediaPlayer.(May be i am not able to find). So if it doesn't have the functionality how can i add two button to fulfill my requirement by editing the Templete of the MediaPlayer.Please Advise me regarding this Issue.

Thanks

Kalyan

0
Miroslav
Telerik team
answered on 06 Jan 2009, 11:10 AM
Hello Kalyan,

You can achieve this without necessarily editing the control template. You just need to make the player advance/go back as mentioned earlier. If you would like to edit the ControlTemplate you will actually need to inherit the control and override some methods there. 

An easier solution will be to place two buttons as an overlay over the media player and handle their click events.

This will involve some positioning but it will be easier than extending the control.

Please, come back to us if you need help with this. Also, I can help you with modifying the ControlTemplate if this is what you decide to do.

Regards,
Miroslav
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
MediaPlayer
Asked by
Greg S
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Greg S
Top achievements
Rank 1
kalyan
Top achievements
Rank 2
Miroslav
Telerik team
Share this question
or