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

Start/restart item in Playlist from javascript

1 Answer 57 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
John asked on 08 Apr 2020, 03:03 PM

Hello, all.

Just getting started with the RadMediaPlayer on a tight-deadline project, and I'm looking over the documentation, and I must be simply missing something.

I've got a playlist set up, and another control outside of the player -- a "featured video" display -- knows an index of an item within the playlist.  I want to click the button and immediately go to the beginning of that video, client-side if possible.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 13 Apr 2020, 02:06 PM

Hi John,

Indeed the MediaPlayer does not provide an API for changing the selected video index directly. Nevertheless, you can achieve that by manually triggering its nested playlist playListItemClick event, passing the desired video index as an argument.

For example, you can use a similar logic:

            function playVideo(sender, args) {
                var mediaPlayer = $find("RadMediaPlayer1");
                var indexToPlay = 3; //your logic here
                mediaPlayer.playlist.trigger("playListItemClick", { index: indexToPlay });
        <telerik:RadButton runat="server" ID="RadButton1" Text="Select file" AutoPostBack="false" OnClientClicked="playVideo" />    

        <telerik:RadMediaPlayer RenderMode="Lightweight" ID="RadMediaPlayer1" runat="server"
            Height="360px" EnableViewState="false" Width="640px" AutoPlay="false">
                Mode="Buttons" ButtonsTrigger="Hover"/>

Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question