Forward, Rewind Buttons & Methods

5 posts, 1 answers
  1. Greg S
    Greg S avatar
    2 posts
    Member since:
    Apr 2006

    Posted 17 Oct 2008 Link to this post

    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
  2. Answer
    Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 19 Oct 2008 Link to this post

    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.
  3. DevCraft banner
  4. Greg S
    Greg S avatar
    2 posts
    Member since:
    Apr 2006

    Posted 20 Oct 2008 Link to this post

    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));

     

  5. kalyan
    kalyan avatar
    38 posts
    Member since:
    Jul 2008

    Posted 30 Dec 2008 Link to this post

    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

  6. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 06 Jan 2009 Link to this post

    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.
Back to Top
DevCraft banner