Skip to main content
Home Forums General Silverlight Hosting and Streaming The url to refer to files hosted at silverlight streaming?
4 replies. Latest Post by TechPreacher on September 28, 2007.
(0)
_mike
Member
12 points
2 Posts
09-21-2007 9:54 AM |
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
09-21-2007 6:47 PM |
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
Participant
798 points
219 Posts
09-26-2007 9:10 PM |
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.
TechPrea...
4 points
09-28-2007 6:32 AM |
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
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?
09-28-2007 7:14 AM |
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.