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

Need Help Clearing Media Sources

4 Answers 86 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 20 Jan 2014, 03:53 PM
Greetings all,

When using the RadMediaPlayer control in my web application, I am having trouble clearing the multimedia sources that have already been loaded into the control.  The user has the option of adding a new link and corresponding description which are saved in a SQL Server table of video records.  This list is loaded into a dropdown box for selection.  When a video is chosen, I am setting the source property as follows, based on the link retrieved from the database:

MMOMediaPlayer.Source = <link from db>

This works fine and the video plays as expected.  However, I want to give the user the ability to clear the control of any video content and reset it to its original state when the page first loaded.  I have a button that performs this function, with server-side code as follows:

MMOMediaPlayer.Sources.Clear()

However, after this code executes, the most recently viewed video is still present in the viewer, and begins to play from the last position (time) within the clip.  I've also tried using MMOMediaPlayer.Sources.RemoveAt(0), but this also seems to have no effect.

Any help would be appreciated.


4 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 22 Jan 2014, 11:50 AM
Hi Bob,

To achieve the desired functionality you need to set the RadMediaPlayer.Source property to empty string and manually to set the toolbar scroll bar’s value to 0. For example:
RadMediaPlayer1.Source = string.Empty;
Page.ClientScript.RegisterStartupScript(Page.GetType(), "SetTime",
     string.Format("setTimeout(function(){{ $find('{0}').set_value(0);}}, 100)",
     RadMediaPlayer1.ClientID + "_Toolbar_ProgressRail"), true);

Additionally I am sending you a simple example which demonstrates that. Please check it out and let me know if it helps you.

Regards,
Radoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Bob
Top achievements
Rank 1
answered on 22 Jan 2014, 05:23 PM
That's what I needed... the problem is fixed!  Thanks for all your help.
0
Russell
Top achievements
Rank 1
answered on 24 Jul 2014, 02:07 PM
I tried to run your sample with RadMediaPlayer and when I tried to clear sources the program threw up an error = "Object doesn't support property or method 'SeekTo'.  I'm attaching a png file.   In addition, when I clicked on Full Screen I received an error = "Object doesn't support property or method 'EnterFullScreen'
0
Radoslav
Telerik team
answered on 29 Jul 2014, 07:40 AM
Hello Russell,

To avoid the described errors you need to change the code behind as following:
protected void Button1_Click(object sender, EventArgs e)
    {
        RadMediaPlayer1.Sources.Clear();
        RadMediaPlayer1.Source = string.Empty;
 
        Page.ClientScript.RegisterStartupScript(Page.GetType(), "SetTime",
            string.Format("setTimeout(function(){{ $find('{0}').seekTo(0);}}, 200)",
            RadMediaPlayer1.ClientID), true);
    }

Please give it try and let me know if it helps you.

Regards,
Radoslav
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
MediaPlayer
Asked by
Bob
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Bob
Top achievements
Rank 1
Russell
Top achievements
Rank 1
Share this question
or