Light Up the Web-Microsoft Silverlight Streaming by Windows Live Microsoft® Silverlight™ Streaming by Windows Live™ is a free streaming and application hosting service for delivering rich interactive applications (RIAs) over the Web. In this article I’ll show you how to get started with Silverlight and how to upload your applications and rich media to the Silverlight Streaming Service. In summer 2007, Microsoft released version 1.0 of Silverlight, a revolutionary way to build rich interactive experiences on the Web. Silverlight is a cross-platform, cross-browser plug-in that extends the browser’s Document Object Model (DOM) with vector graphics and multimedia features. Based on XML Application Mark-up Language (XAML), the same technique used in the Windows Presentation Foundation (WPF), Silverlight can be scripted with JavaScript and can work within AJAX-enabled Web pages. | " | It’s just as easy to deliver Silverlight experiences from PHP sites on Apache/Linux as it is from ASP.NET sites on a Windows Server.
| " |
Silverlight provides a consistent user experience with Firefox and Safari on the Mac and Firefox and Internet Explorer on Windows. Even Linux users can run Silverlight using Novel’s open-source Moonlight code. In fact, you’re not locked into the Microsoft platform at all-it’s just as easy to deliver Silverlight experiences from PHP sites on Apache/Linux as it is from ASP.NET sites on a Windows Server. Hello World in Silverlight You need to install the Silverlight 1.0 runtime for your browser. The first time you visit a Silverlight enabled site like http://www.microsoft.com/silverlight, you'll be directed to an installation process. The runtime is surprisingly small (less than 2 MB) and is quick and painless to install. I’ll start with a simple Silverlight “Hello World” demonstration. Using XAML, define a Canvas that includes a TextBlock with the “Hello World” text and save this file as Hello.xaml (Listing 1). Create an HTML page to host the Silverlight control; call it Default.html (Listing 2). You must also provide two JavaScript files. Silverlight.js is part of the Silverlight SDK and CreateSilverlight.js is shown in Listing 3. CreateSilverlight is the code responsible for instantiating the Silverlight control with your XAML. You should now have four files: default.htm, Hello.xaml, CreateSilverlight.js, and Silverlight.js. Launching default.htm in a browser runs the application (Figure 1).  Figure 1: Running the Silverlight Hello World application.Silverlight Streaming Microsoft has a software and service strategy and this is where the Silverlight Streaming by Windows Live service comes in-developers can deploy their Silverlight applications and rich media “in the cloud,” leveraging Microsoft’s high performance, high availability content distribution network. While the product is in pre-release, storage and delivery is free up to 4 GB, with outbound streaming up to 700 Kbps. After release, developers will have continued use of the service with up to 1 million minutes of free video streaming at 700 Kpbs per site per month. Unlimited streaming will be available for free with advertising or, for a nominal fee, without advertising. You can sign up for a free Silverlight streaming account at http://silverlight.live.com. You need a Windows Live ID to get started or you can create a new Windows Live ID for free. Uploading Now move your Hello World sample to the Silverlight Streaming Service. First create a manifest.xml file, which describes the constituent parts of your Silverlight Streaming application: <SilverlightApp> <version>1.0</version> <source>Hello.xaml</source> </SilverlightApp>
For this simple example, you no longer need the default.html or JavaScript files. You just need to create a Hello.zip file that contains manifest.xml and Hello.xaml. On Windows, multiple select the files, right-click and select Send To Compressed (zipped) folder-you can use any of the popular ZIP compression programs, but you need to make sure that the manifest file appears in the top-level root of the zip file-zipping the parent directory is a common error and will not work! Log in to Silverlight Streaming at http://silverlight.live.com using your Windows Live ID and click Manage Applications. Select Upload a Silverlight Application, specify a name (Hello) and browse for your Hello.zip file. Click Upload (Figure 2).  Figure 2: Uploading the application to Silverlight Streaming.Depending on your connection speed, this may take a while. If all goes well, you will be presented with a page that allows you to test your application. You will also be given sample HTML and JavaScript that you can cut and paste into your own Web site to run the application (Figure 3).  Figure 3: Having uploaded your application, test links and sample code are automatically created.Click Launch Application Test Page (Figure 4).  Figure 4: Click Launch Application Test Page to run your application.You can also provide a link for others to run your application using an IFRAME. The URL is of the form: http://silverlight.services.live.com/ invoke/accountId/appName/iframe.html
Where accountId is your Silverlight Streaming numeric account identifier and appName is the name of your application (in this case Hello). You can find out your accountId by clicking the Manage Account link. The IFRAME invoker redirects you to an obfuscated URL as in Figure 5.  Figure 5: Invoke your application directly within an IFRAME. |