Microsoft Silverlight is a programmable web browser plugin that enables features such as animation, vector graphics and audio-video playback that characterize rich Internet applications. Version 2.0, released October 2008, brings additional interactivity features and support for .NET languages and development tools. It is compatible with multiple web browser products used on Microsoft Windows and Mac OS X operating systems. Mobile devices, starting with Windows Mobile 6 and Symbian (Series 60) phones, will also be supported. A third-party free software implementation named Moonlight is under development to bring compatible functionality to GNU/Linux.
Overview
Silverlight provides a retained mode graphics system similar to Windows Presentation Foundation, and integrates multimedia, graphics, animations and interactivity into a single runtime environment. It is being designed to work in conjunction with XAML and is scriptable with JavaScript. XAML can be used for marking up the vector graphics and animations. Textual content created with Silverlight is searchable and indexable by search engines as it is not compiled, but represented as text (XAML).Silverlight can also be used to create Windows Sidebar gadgets for Windows Vista.
Silverlight supports playback of WMV, WMA and MP3 media content across all supported browsers without requiring Windows Media Player, the Windows Media Player ActiveX control or Windows Media browser plugins. Because Windows Media Video 9 is an implementation of the SMPTE VC-1 standard, Silverlight also supports VC-1 video, though still only in an ASF container format. Furthermore, the Software license agreement says VC-1 is only licensed for the "personal and non-commercial use of a consumer". Silverlight does not support playback of H.264 video, though support in future versions has been officially announced. Silverlight makes it possible to dynamically load XML content that can be manipulated through a DOM interface, a technique that is consistent with conventional Ajax techniques. Silverlight exposes a Downloader object which can be used to download content, like scripts, media assets or other data, as may be required by the application. With version 2.0, the programming logic can be written in any .NET language, including some common dynamic programming languages like Ruby and Python.
Releases
Silverlight 1.0
A Silverlight 1.0 application hosted in Internet Explorer. Interactivity is provided by Silverlight, but user input controls are HTML controls overlaid on top of Silverlight contentSilverlight 1.0, which was developed under the codename Windows Presentation Foundation/Everywhere (WPF/E), consists of the core presentation framework, which is responsible for UI, interactivity and user input, basic UI controls, graphics and animation, media playback, Digital rights management, and DOM integration. It is made up of the following components:
Input – handling input from devices like keyboard, mouse, stylus etc.
UI core – managing rendering of bitmap images (including compressed raster images like JPEG), vector graphics, text and animations.
Media – playback of MP3, WMA Standard, WMV7, WMV8 and WMV9/VC-1 streams.
XAML – to allow the UI layout to be created using XAML markup language.
A Silverlight application starts by invoking the Silverlight control from the HTML page, which then loads up a XAML file. The XAML file contains a Canvas object, which acts as placeholder for other elements. Silverlight provides various geometrical primitives like lines, ellipses and other shapes, to elements like text, images, and media etc. The elements are properly positioned to achieve the desired layout. Any arbitrary shape can be created as well. These elements can be animated using Event triggers; some animation effects are predefined, others can be created as composite of the pre-defined effects. Events like keyboard or mouse movements can also raise Events which can be handled by custom scripts.
Programmatic manipulation of the UI is achieved by using scripting languages to modify the Document Object Model of the Silverlight Canvas object. To facilitate this, Silverlight exposes a DOM API, accessible from any scripting language supported by Silverlight, which in version 1.0 release is limited to JavaScript running in the browser. However, there are no UI widgets built in. The native widgets of the browser must be overlaid on top of the Silverlight Canvas for user input. Support for data formats is limited to XML and JSON only.
Silverlight 2
A Silverlight 2 application hosted in Internet Explorer.Version 2.0 brings improved interactivity and support for .NET languages and development tools.
Silverlight 2.0 (previously referred to as version 1.1) includes a version of the .NET Framework, implementing the same full Common Language Runtime version as .NET Framework 3.0; so it can execute programs written in any .NET language (however you can not reference assemblies compiled with the regular .NET Framework by default). Unlike the CLR included with .NET Framework, multiple instances of the CoreCLR included in Silverlight can be hosted in one process. With this, the XAML layout markup file (.xaml file) can be augmented by code-behind code, written in any .NET language, which contains the programming logic. It can be used to programmatically manipulate both the Silverlight application and the HTML page which hosts the Silverlight control. The XAML markup as well as the code, is compiled into .NET assemblies which are then compressed using ZIP and stored in a .xap file.
Silverlight ships with a lightweight class library which includes features such as extensible controls, XML Web Services, networking components and LINQ APIs. This class library is a subset of, and is considerably smaller than, .NET Framework's Base Class Library. Silverlight code runs in a sandbox, thus preventing the invocation of platform APIs.
A set of Silverlight controls rendered with different skinsThe version of .NET Framework in Silverlight adds a subset of WPF UI-programming model, including support for shapes, documents, media and animation objects of WPF. Beta 2 onwards,[15] it ships with more than 30 UI controls (including TextBox, CheckBox, Slider, ScrollViewer, and Calendar controls), for two-way databinding support, automated layout management (by means of StackPanel, Grid etc) as well as data-manipulation controls, such as DataGrid and ListBox. UI controls are skinnable using a template-based approach. Third-party libraries of expanded UI-control sets are also available.
Silverlight 2 ArchitectureThe included Base-Class Library (BCL) provides classes for collections, reflection, regular expressions, string handling and data access. It also supports LINQ, with full support for LINQ to Objects and expression trees. Almost all of the System.LINQ and System.LINQ.Expression namespaces are exposed. It also supports serialization of objects, for data persistence. Silverlight can handle data in RSS or JSON format, in addition to XML. The BCL provides enhanced support for working with XML data, including the XMLReader and XMLWriter classes. Silverlight 2 also supports asynchronous programming via the use of the threading libraries.
Silverlight also includes classes for data access over XML-based Web services, REST, WCF Services and ADO.NET Data Services. The networking support in Silverlight can be used by Silverlight applications to communicate using HTTP, or at the lower socket level. Cross-domain communication is supported. Silverlight uses an XML-based configuration file to control the cross-domain resource-access policy, for both HTTP and socket connections. It can be used by site administrators to control which resources a Silverlight application can access, when that application did not originate in the domain of the site. In addition, Silverlight also supports the Adobe Flash cross=domain-policy file format. Silverlight sockets can only initiate a connection; they cannot listen for connections.
A Python interpreter in Silverlight 2 hosted in Mozilla FirefoxSilverlight 2 includes the Dynamic Language Runtime (DLR) which allows dynamic compilation and execution of dynamic (scripting) languages. Compilers for the languages based on the DLR (including IronPython and IronRuby) are [to be?] packaged with the DSL app in the .xap package. The DSL SDK includes a web server named Chiron, that can dynamically package all the dependencies for the DSL application and serve it to the browser. The first upcoming languages written for the DLR are Managed JScript, IronPython 2.0, and IronRuby. Microsoft also plans to build Visual Basic .NET 10.0 (VBx) on the DLR. All four languages share the same infrastructure, to allow Silverlight to compile and execute the language source. Conversely, other .NET languages must be compiled ahead-of-time and delivered to Silverlight as .NET assemblies. The implementation of Managed JScript conforms to the ECMAScript 3.0 specification, and Microsoft claims that it is 250 times faster than interpreted JScript.
With the integration of .NET Framework, Silverlight also allows HTML-managed code interaction, which enables the manipulation of HTML DOM elements from managed code, and permits JavaScript code to call managed code and use objects instantiated by managed code. Silverlight encloses JavaScript objects and DOM elements in managed wrappers to make them available from managed code.While there is no provision for calling JavaScript code directly in the 1.1 alpha release, managed-code events can fire JavaScript handlers. A Silverlight instance does not need to have a UI component in order to manipulate the HTML DOM from managed code. It is done by creating an XAML Canvas with both width and height set to zero, and using its code-behind code to modify the Document Object Model of the HTML page via the APIs in the System.Browser namespace.
A Silverlight 2 application using DeepZoom, running in Safari 3.1, on Windows XPSilverlight 2 includes Deep Zoom, a technology derived from Microsoft Live Labs Photosynth. It allows users to zoom into, or out of, an image (or a collage of images), with smooth transitions, using the mouse wheel. The images can scale from 2 or 3 megapixels in resolution into the gigapixel range, but the user need not wait for it to be downloaded entirely; rather, Silverlight downloads only the parts in view, optimized for the zoom level being viewed. Beta 2 onwards, Deep Zoom uses an XML-based file format.
New media features in Silverlight 2 include:
WMA Professional support, including new WMA 10 Pro low-bitrate modes, although multi-channel audio content is still restricted to stereo playback
Content protection powered by Microsoft PlayReady DRM client
Server-side playlists in Windows Media Services
Media Stream Source API
The Media Stream Source is a powerful API that's responsible for enabling another much-talked-about feature: adaptive streaming of media. Adaptive streaming allows the player application to choose the bit rate of the media based on available client bandwidth and CPU resources. Media Stream Source allows the developer to specify a custom method of retrieving media data, the only requirement being that the final video and audio streams be presented to Silverlight runtime in a format that Silverlight can decode (VC-1, WMA, MP3, etc). This allows extensible support for otherwise natively unsupported file formats (i.e. MP4, Matroska, Ogg), protocols (i.e. Shoutcast) and delivery methods (i.e. adaptive streaming, P2P). Microsoft first publicly showcased the power of Media Stream Source by powering the NBC Olympics website with their own implementation of adaptive streaming.