silverlight: embedding the plugin
| Comments- | Posted in
- silverlight streaming
- silverlight
- blend
- expression blend
- mix
- mix07
- manifest
so what happens when you want to embed silverlight in your page? well if you have absolute control over your site, you may not need to worry as you'll post your silverlight applications as-is. but what if you want to just output some smaller silverlight applications in specific areas in your site, blog, etc?
enter silverlight streaming. this was announced at mix07 where you get 4gb storage for free. now, there are some caveats that you should read about -- the 4gb is total storage, but the per-app upload has some limits...so be sure to read...it may not meet every need. but if it does, you'll have to know some things.
first, the "streaming" has been throwing people off, and i think i understand why. our techno geek brains are telling us that "streaming" means media files directly. because of this people have been asking me they thought you'd upload a wmv file or something and the silverlight streaming would provide a player, etc. as the output. not so. silverlight streaming is enabling you to host/stream the entire silverlight application. so basically you develop the wicked-cool-super-slick and want somewhere to host it, the xaml files, associated media, etc. boom, silverlight streaming may be a solution to you.
now, you may have your app, go to silverlight.live.com and then say, huh, now what? well first you should probably take a look at the sdk link (on the left), then on the right there is a link for create application (under the essential links). there is some important information for you here. the most important is the creation of a manifest.xml file. this is describing your application files requires, your manifest, etc. it will look something like this:
<SilverlightApp> <source>Scene.xaml</source> <width>400</width> <height>50</height> <jsOrder> <js>Silverlight.js</js> <js>Scene.xaml.js</js> <js>Default.html.js</js> </jsOrder> </SilverlightApp>
once you have that, you need to zip all your files up...except certain ones :-) -- like .media, .html, .aspx, .zip (more on this one later). you'll have a zip file that might look something like this:
once uploaded, then you'll have to follow the silverlight embed directions (a 3 step process -- or 2 if you don't want to create another file). below i've embedded in this blog post:
go ahead, click it :-)
the core of the functionality is in the third step the instructions provide you which will look something like this:
function CreateSilverlight() { Sys.Silverlight.createHostedObjectEx( { source: "streaming:/217/SimpleButtonClick", parentElement: SimpleButtonClickWrapper}); }
okay, now for a few gotchas i've found early on. first, the complexity of your silverlight app may get your frustrated when you upload it. for example, i've taken an output player from expression media encoder and it didn't exactly work (although i'm still troubleshooting it, i suspect i know some problems). one of the reasons why is that it uses some createObject funkadelicness when creating the initialization of the event handlers, etc. because of this you'll have to look at the loadFunction and onLoad parameter nodes of the manifest file.
second, i am assuming that silverlight streaming is leveraging a feature of silverlight that enables you to compress your assets (or perhaps your entire application) in a zip file. then using items like the downloader, you can download the zip file (which might be considerably smaller and save some bandwidth) and then pull out what you need from the zip. it is quite cool, and i have a sample in another post (subscribe now, hint hint). anyhow, where was i? oh yeah, well .zip files are not allowed to exist within your .zip application...wait, does that make sense? basically if you are using that mechanism, it might not work in the silverlight streaming scenario...quite frankly it didn't work for me...maybe more to come on that.
so start your silver-engines, and download some tools, build some apps, upload them and host them...giddyup.
Please enjoy some of these other recent posts...
Comments