Skip to main content

Microsoft Silverlight

Unanswered Question Video UrlsRSS Feed

(0)

meetchandu
meetchandu

Member

Member

28 points

32 Posts

Video Urls

Hi All

I was able to upload few videos successfully. I am using teh Media control in ASP.NET Futures. The video Url i have is

streaming:/xxxx/6eff01ebfa764660a0df0b5c77a8c368/04930650b0314d0cb0c441f3f7c1d8f6_Butterfly.wmv. How do I use this to set the MediaUrl property of the control

I prefer doing this in C#.

Please suggest

 

Frogs69
Frogs69

Participant

Participant

798 points

219 Posts

Microsoft

Re: Video Urls

Hi, right now this is only possible by passing the video "URL" at initialization time through initParams. If your video file is hosted in SLS, by virtue of passing a streaming:/ "URL" via the initParams of your app, you'll be able toassign the value to a media source asit will be converted to a http:// URL consumable in the code of your app. This is documented on http://dev.live.com/silverlight/initparams.aspx.

However it looks like you're mixing up the made up URL to Silverlight Streaming with the fully qualified URL into the CDN cache. The former should be constrcuted as streaming:/your_SLS_account_ID/file_set/file_name.wmv. The latter is usually some long and ugly http:// URL with a time stamp, a file signature, and a ton of CDN cache information on the path. You should not use that URL.

I do not have a C# sample, but I can give you a XAML one if you like.

Cheers.

meetchandu
meetchandu

Member

Member

28 points

32 Posts

Re: Video Urls

Thanks for the information. I would really appreciate if you can provide the xaml code

Frogs69
Frogs69

Participant

Participant

798 points

219 Posts

Microsoft

Re: Video Urls

Hi, I have posted it on http://dev.live.com/silverlight/downloads/SL_v1_player_sample.zip. The v10 folder contains a regular SL v1 player (xaml and js) from Expression Encoder. The files relevant to this thread are: WebPageSample.htm and JavaScriptSample.js.

In WebPageSample.htm the parts that matter are the following:

<script type="text/javascript" src="JavaScriptSample.js"></script> this is where you reference the script

var p = new StartPlayer(); this is where you create the instance of your player on your site.

In JavaScriptSample.js, the parts that matter are the following:

initParams: ["streaming:/SLS_account_ID/File_set/File_Name.wmv"] this is where you pass the "URL" to your video file

this._player.set_mediaUrl (params[0]); this is where you set the value of mediaUrl to be the translated http URL

Hope this helps.

meetchandu
meetchandu

Member

Member

28 points

32 Posts

Re: Video Urls

Great.. Thank you very much for the sample. Cant we do that same stuff that we do in js in C#/.

Like for example, If i have a media control on the xaml page. Cant i set the source property to some url using C# code rather than js?

 

Buhari
Buhari

Member

Member

2 points

1 Posts

Re: Video Urls

Hello,

I am working on how to connect silverlight streaming video using MediaElement's Source property in C#.

I could not find it out any sample in net.

But I tried . Can anyone tell me what is the issue with the following code?

 

private void OnStartup(object sender, StartupEventArgs e)

{

// Load the main control here

string sVideoUri = e.InitParams["video1"].ToString(); //video1=streaming:/<acct id>/Lake/Lake.wmv

this.RootVisual = new Page();

MediaElement meVideo = ((MediaElement)((UserControl)this.RootVisual).FindName("meVideo"));

 

meVideo.SetValue(
MediaElement.SourceProperty, new Uri(sVideoUri,UriKind.RelativeOrAbsolute));

meVideo.Play();

}

 If you have any workign samples in C#, please share it?

Thanks

KevMoore123
KevMoore123

Member

Member

8 points

4 Posts

Re: Re: Video Urls

Hi

Did you ever get anywhere with this?  I too am trying to stream content from my SLS account to a MediaElement control in SilverLight 2.

cheers

Kev

meetchandu
meetchandu

Member

Member

28 points

32 Posts

Re: Re: Video Urls

Nope.. that didnt work. looks like js is the only option. If you are not restricted to use silverlight media element you could use the live controls

 

 

Frogs69
Frogs69

Participant

Participant

798 points

219 Posts

Microsoft

Re: Re: Video Urls

See http://silverlight.net/forums/t/12326.aspx...

Cheers.

SpartyGuy
SpartyGuy

Member

Member

4 points

2 Posts

Re: Video Urls

If you have the ability to run some of your own asp.net code on your server, you can check out my solution to this problem.

 http://www.slickthought.net/post/2008/04/Cracking-the-Silverlight-Streaming-Direct-Content-Access-Code.aspx and http://www.slickthought.net/post/2008/05/Cracking-the-Silverlight-Streaming-Direct-Content-Access-Code---Part-II.aspx

Both are a lot "cleaner" to use on the client than dealing with funky initParams and such.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities