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

Set initParams for RadMediaPlayer

1 Answer 109 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
Dako -
Top achievements
Rank 1
Dako - asked on 20 Nov 2009, 03:26 PM
Hi,

At the moment I'm setting up a website which supports streaming. My streaming services are provided by Windows Media Services, which is installed on a windows server 2003. In Windows Media Services I set up a publishing points which generates a mms address, I'm able to use this mms address as video source. In several free Silverlight players I did this with success, by just setting up params in an HTML document which includes my mms address as source.
Since I'm so satisfied about Telerik's RadUpload wich I already have in use for my site, I've decided to use the RadMediaPlayer as wel. Although I have a (little) problem.

First my code:
<html> 
<object data="data:application/x-silverlight," type="application/x-silverlight-2" width="625" height="457"
    <param name="source" value="ClientBin/Mediaplayer.xap"/> 
    <param name="onerror" value="onSilverlightError" /> 
    <param name="windowless" value="true" /> 
    <param name="background" value="transparent" /> 
    <param name="initParams" value="VideoSource=bigbuckbunny.wmv,AutoPlay=enable,EnableScrubbing=true,InitialVolume=1" /> 
    <param name="autoUpgrade" value="true" /> 
    <href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"
        <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/> 
    </a> 
</object> 
<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe> 
</html>  


For some reason my HTML document does not work for the RadMediaPlayer. When my site loads Mediaplayer.xap, I do see the RadMediaPlayer and the Silverlight plug-in uses all the param names except for initParams. This code worked for the other players I used. For the moment I'm just trying to open the VideoSource locally instead of from the server, so VideoSource=bigbuckbunny.wmv for this example.

Is it possible with the RadMediaPlayer to define the source of the video this way, or am I missing something? I need to define the source this way, because I will put a database query behind the VideoSource in the present.

Any help would be greatly appreciated.

With kind regards,

Dako

1 Answer, 1 is accepted

Sort by
0
Dako -
Top achievements
Rank 1
answered on 24 Nov 2009, 09:01 AM
Hi all, I have found the solution for my own problem:

In the app.xaml.cs set e.initParams. See example:
private void Application_Startup(object sender, 
    StartupEventArgs e) 
  this.RootVisual = new Page(e.InitParams); 

In the mainpage.xaml.cs use the initParams as variable:

public partial class Page : UserControl 
  public Page(IDictionary<stringstring> initParams) 
  { 
    InitializeComponent(); 
    _TextField.Text = "My Favorite Color is: " + initParams["favColor"]; 
 
    _TextField2.Text = ""
    foreach (string key in initParams.Keys) 
      _TextField2.Text += key + ": " + initParams[key] + "\n"
  } 

This solved it for me, although I used MediaElement.Source = new System.Uri(initParams["VideoSource"]) for my problem.





Tags
MediaPlayer
Asked by
Dako -
Top achievements
Rank 1
Answers by
Dako -
Top achievements
Rank 1
Share this question
or