Microsoft Silverlight Streaming by Windows Live is a free streaming and application hosting service for delivering rich interactive applications (RIAs) over the web. Silverlight supports a range of video formats including high definition (HD) and (SMPTE) VC-1.
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.
In this article you'll see how to get started with Silverlight and how to upload your applications and rich media to the Silverlight Streaming Service.
"Hello World" in Silverlight
Users need to install the Silverlight 1.0 runtime for their browsers. The first users visit a Silverlight-enabled site such as http://www.microsoft.com/silverlight
, they're directed to an installation process. The runtime is surprisingly small (less than 2 MB) and installs quickly and painlessly.
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
<TextBlock FontFamily="Times New Roman"
Text="Hello World" />
Create a short HTML page to host the Silverlight control, and call it Default.html
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
, is part of the Silverlight SDK, so you get it when you download the SDK. The second, CreateSilverlight.js
contains the code responsible for instantiating the Silverlight control with your specific XAML page. Here's the code:
|Figure 1. Running the Silverlight Hello World Application: Loading the default.htm page runs the CreateSilverlight.js script to instantiate the Silverlight control.|
You should now have four files: default.htm
, and Silverlight.js
. Launching default.htm
in a browser runs the application (see Figure 1
|Editor's Note: This article was first published in the "Windows Live" edition of CoDe Focus Magazine (2008, Vol. 5, Issue 2), and is reprinted here by permission.|