Limiting Seeking on MediaPlayer

4 posts, 0 answers
  1. Abimael
    Abimael avatar
    9 posts
    Member since:
    Dec 2010

    Posted 20 Apr 2011 Link to this post

    Hi Everyone:

    I need to the playing start and finish on the media player. Let me explaing a little bit more what I want to do.

    I have an audio file (MP3, WAV, etc), and for that audio file I had defined a list ok pieces, like the chapters, something like this (asuming the audio file has 2 minutes):

    Piece 1
    StartTime 00:00
    EndTime 00:15

    Piece 2
    StartTime 00:15
    EndTime 00:25

    Piece 3
    StartTime 00:20
    EndTime 00:33

    Piece 4
    StartTime 00:30
    EndTime 01:00

    Piece 5
    StartTime 00:50
    EndTime 01:20

    Piece 6
    StartTime 01:00
    EndTime 02:00

    If you see, some pieces overlaps other pieces, but I want to limit the playing of the audio file, like, when we take the Piece 3, the media player only let play audio from 00:20 to 00:33, showing on the screen if like the whole file is only 13 seconds long, when we press the play button the player start playing the file from the 00:20 position like if the position was 00:00, and when the player reach the 00:33 time, it shows like if the player is on the 00:13 second, end it stops the playing. And the same aplies to the other Pieces, is something like defining Chapters, with the diference that it can overlap other "Chapters" and the player only show the time for that "Chapter".

    Is there a way to do that? May be only using one Chapter by updating its start and end time, or defining more than one chapter, but the media player must limit the playing like if the time defined on the chapter is the real whole file.

    I hope that you understand the "little thing" that I want to do, and my bosses are evaluating this control to decide if they must buy the Premium Colletion (the one that cost 1299$ and includes every control), because we want to use the ASP.NET AJAX, the Silverlight, the WPF and the Reports controls. But this little feature is holding them back.

    Thanks for your help.

    Abimael Ordonez.
    MangauSystems.
  2. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 26 Apr 2011 Link to this post

    Hello Abimael,


    During the design of the MediaPlayer we didn't take this case into consideration. The progressbar is designed to perform media navigation based on the whole movie length. Also the chapters are intended to be only marks on certain places not whole ranges inside the media. So the previous chapter will end when the next chapter is reached. Actually there is only logic triggered when a new chapter is reached that performs the changed of appropriate visuals.

    The best approach would be to cut the movies in parts. I think this in fact is the scenario you are describing.

    I'm not quite sure is you want to display all the chapters or only the currently playing one. If you want to display all the chapters then you should try to modify the control template of the MediaPlayerWrapper to display the time you want using a converter. Also the chapter control template may be changed to simulate the range overlapping behaviour.

    If you want to show only the current chapter then you should also add controls to support navigation between chapters.


    All the best,
    Hristo
    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
  3. DevCraft banner
  4. Abimael
    Abimael avatar
    9 posts
    Member since:
    Dec 2010

    Posted 27 Apr 2011 Link to this post

    Hello Hristo:

    The approach of cut the movies in parts that you suggested is out off question (by my bosses, not by me). There must be only one file and just play parts of it on the client side. They already had a solution that generates those files and dont want to put the overhead of slicing the file at runtime.

    By saying that, can you give me an example of the MediaPlayerWrapper of the other solution that you gave me?

    Putting it simple words: I need a method to say the MediaPlayer to only play a audio file from and to an especific interval of time. Or may be a solution: Hide the mediaplayer (this to disable the user interacting directly with the player), define an update event to known where on time is the audio file playing and limit the playing only to the time I defined, add an slider control with the lower and upper limits as the Piece that I want to play, I think that you know what I want to say. Can this be a solution? Do you have an example of how to hide the player and define the update event?

    I will make some tests based on this, and will let you know how this works, but I'll appreciate any examples that you can give me.

    Thanks in advance and best regards.

    Abimael Ordonez.
    MangauSystems.
  5. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 02 May 2011 Link to this post

    Hi Abimael,

    The suggested approach applicable and it sounds simpler than editing the control template. It would require to develop custom behaviour in order to manage the playback of different chapters and it bypasses the default player behaviour. I created a sample project demonstrating how this can be achieved easily. I'm using a collection of ChapterData objects which contain the movie source URI and time info about the chapters. You can see the movie URI is the same for all items but you have the freedom to specify URIs of different movies.
    Another option is to have the chapters data encapsulated as a collection into single data item. Thus the MediaPlayer source will contain "whole movies" and the inner chapters collection should be used when managing the chapters.

    Hope this helps.

    Regards,
    Hristo
    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
Back to Top