Skip to main content

Microsoft Silverlight

Answered Question The url to refer to files hosted at silverlight streaming?RSS Feed

(0)

_mike
_mike

Member

Member

12 points

2 Posts

The url to refer to files hosted at silverlight streaming?

What's the url to refer to files hosted at silverlight streaming?

I had thought it was:  https://silverlight.services.live.com/id/project/folders/files ... but that isn't working for me. Am I just missing a port number, or should I be referring to them in some other way in the codebehind?

Both relative & absolute paths work via BrowserHttpWebRequest on my localhost, but when I try the streaming host version I get a cross domain error.

Thanks, Mike

_mike
_mike

Member

Member

12 points

2 Posts

Answered Question

Re: The url to refer to files hosted at silverlight streaming?

To answer my own question (in case it's of interest to others):  while xaml seems to be able to refer to subfolders within the application zip file, C# doesn't seem to be able to.  Unless I'm doing it wrong of course.  In any case, putting all the files I was reading in the root folder & just using the files' names as a relative link is very messy, but it works.

I'd add being able to read from subfolders of the root directory to the wishlist for 1.2, if it isn't there already.

- Mike

Frogs69
Frogs69

Participant

Participant

798 points

219 Posts

Microsoft

Re: The url to refer to files hosted at silverlight streaming?

You cannot refer directly to files in Silverlight Streaming. You can access them via URLs like streaming:/accountID/appName/fileName if you use initParams in your app (cf. http://dev.live.com/silverlight/initparams.aspx) and the service translates this URL into a fully qualified URL to fetch your content in the CDN (Content Delivery Network). While you can capture this http URL in the CDN, it is not recommended as it will expire, to make sure that there are no pointers to stale or no longer existing content in the CDN cache.

TechPreacher
TechPrea...

Member

Member

4 points

2 Posts

Re: The url to refer to files hosted at silverlight streaming?

I see that, it's documented in the Silverlight SDK (http://dev.live.com/silverlight/initparams.aspx). But one thing remains unclear.

 The SDK says:

Note that this mechanism does not rewrite your .xaml files in any way. You must take the translated initParam: values and programmatically use them to set the Source properties of your MediaElements, Images, etc.

So I changed the reference to Silverlight.js, added the initParams: "hostedVideo=streaming:/1234/appname/videoname.wmv", to Silverlight.createHostedObjectEx() and created an event handler:

function onClick1(sender, mouseEventArgs) {
sender.findName(
"Media").Source = hostedVideo;
sender.findName(
"Media").Play();

But the video is not streamed from the server...

Question: can I simply refer to he initParam: "hostedVideo" as described in he function above? Or do I have to rewrite this?

TechPreacher
TechPrea...

Member

Member

4 points

2 Posts

Re: The url to refer to files hosted at silverlight streaming?

Tee-hee. this is a self-help forum. Found the working code from the Silverlight 1.0 SDK:

function onClick1(sender, mouseEventArgs) {
// Retrieve a reference to the plug-in.
var plugin = sender.getHost();
// Retrieve the InitParams value and split comma-delimited string.
var params = plugin.initParams.split(",");
sender.findName(
"Media").Source = params[0];
sender.findName(
"Media").Play();
}

does the trick.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities