views:

935

answers:

2

I have a video player that I made with Silverlight 2, and to pass parameters in I'd have the following in the html file hosting it inside the SilverLight object tag:

<param name="initParams" value="path=http://foo.bar/pathToVid.wmv,
                                                autoplay=false" />

This works in browser, but with the "out of browser" experience in SilverLight 3, the HTML file is autogenerated inside:

AppData\LocalLow\Microsoft\Silverlight\Offline{{hostname}}.n\index.html

Or the equivalent on OS X; so this doesn't really work.

I'd like to take a command line argument after the application is launched and just use that as the video source, turning my SilverLight app into a general purpose video player. Is there any way to do this with the out of browser SilverLight?

+1  A: 

With the current state of the Silverlight 3 Beta, there is no ability to pass parameters in to the application when it starts up.

You might want to rethink the features of your application if you want it to be run out of the browser. If your end user gets to chose the location of the video they want to play, you should give them the ability to enter that URL inside of your application rather than passing it as a parameter. On the other hand, if you want the URL to be dynamic but provided by a third party, you could build a service that runs on your site that provides the URL to your Silverlight app at run-time.

Just remember that if you're talking about the second, you need to build in some kind of connectivity checking so that the app doesn't sit there spinning its wheels when it starts...

Justin Niessner
A: 

For some small bits of information, you could potentially write out some data into isolated storage, and then read from your out-of-browser app.

NikhilK