Manage Learn to apply best practices and optimize your operations.

Choosing the best strategy for Silverlight developers

Learn why many Silverlight developers are trying to figure out the best way to transition their existing Silverlight applications to HTML5.

Until recently, multiple vendors, including Microsoft, Adobe and Oracle/Sun, were competing to provide rich Internet application (RIA) frameworks for creating applications that could be delivered via the Web. However, this led to some fragmentation of the market. Some of the main challenges of these platforms included the need for special plug-ins, security risks and increased power requirements.

HTML5 has emerged as a standard framework for providing most of the features and functionalities of these RIA frameworks. As a result, vendors like Microsoft have started investing more effort in supporting this vendor-neutral standard. Silverlight has not gone away, but Microsoft is investing more attention in this emerging Web standard, and has advocated various steps developers can take to transition their existing Silverlight applications to HTML5.

In 2011, Bob Muglia, president of the software and tools division at Microsoft, announced that Microsoft's Silverlight strategy had shifted. At the time, many developers were hoping Microsoft would continue to evolve the Silverlight platform, owing to its rich feature set.

Scott Barnes, rich platforms product manager for the Microsoft UX Platform team, covered some of the issues involved in the transition away from Silverlight. He noted that developers won't have to learn HTML5 or C++ in order to create new HTML5 applications. Microsoft has taken the body of work found in Silverlight and made it handle the rendering of XAML.

Despite all the huff about the end of Silverlight, Microsoft still maintains the Silverlight Developer Center and there are plans to support the platform through at least 2021.

Media giants make the transition

Silverlight was first introduced by Microsoft in early 2010. Despite the overwhelming market share of Adobe's Flash platform, Microsoft was able to gain traction with the adoption by Netflix and a variety of other media companies. Developers were attracted by the ability to stream 1080P HD video and to secure content using digital rights management (DRM) capabilities baked into the Silverlight platform. It also came with battery management features that helped to reduce power consumption while playing videos on mobile devices.

However, Silverlight began losing some of its luster with the rise of HTML5. A variety of new features in the specifications promise to deliver many of the benefits of the RIA frameworks, which can be run in modern browsers with no plug-ins. Most recently, Netflix made a strategic decision to transition from the Silverlight platform to HTML5, and cited some of the emerging new HTML5 features that made the transition possible:

  • Media Source Extensions extend HTMLMediaElement to allow JavaScript to generate media streams for playback. This makes it possible to download media content from content distribution networks, which can be fed into video tags for playback.
  • The HTML5 Encrypted Media Extensions allow HTMLMediaElement to control playback of encrypted content. This provides much of the required functionality for DRM. It also allows developers to integrate with a variety of DRM systems for use on the browser.
  • The W3C Web Cryptography API makes it possible to encrypt communications on the wire and can help protect user data from inspection and tampering. Netflix said this allows them to provide their subscription service on the Web.

From Silverlight to HTML5: Making the move

In order to help developers transition to HTML5, Microsoft released a guide at the recent Microsoft Build Conference that provides recommendations for many of its technologies, including Silverlight for .NET developers.

It noted that if you are transitioning to native applications, you can leverage existing skills and code by targeting XAML and .NET natively on any Windows devices. Portable libraries will allow you to share binaries between different platforms. Silverlight's interoperability with HTML5 can also enable a gradual transition through hybrid applications. However, if your current application only supports Silverlight for features like video content protection, Microsoft recommended the continued use of Silverlight.

The guide also included information about Silverlight migration paths. It noted that RIA containers are being replaced by other alternatives with broader device support like HTML5 or better device integration. Silverlight developers can make this transition gradually. Silverlight applications can also be deployed within HTML content using the Silverlight client-side plug-in.

When Silverlight applications are tightly integrated to the back end, you should consider decoupling these so a transition is easier down the road. This will allow multiple front ends to be built using HTML4, HTML5, Silverlight or native smartphone code, enabling connection with the same back end.

For Web solutions like video streaming, Microsoft recommended using HTML5 in order to support all of the multi-vendor devices. Developers need to consider the media formats and codec required for the target devices. It also recommended adopting fallback approaches by using Silverlight plug-ins for older browsers that do not support HTML5.

For advanced Web media solutions -- like private video -- that include features like 3D video and digital video recording, Microsoft recommended maintaining the current app in Silverlight and planning a progressive migration path to HTML5 when the required features are added.

For public Web applications, Microsoft suggested transitioning to HTML5 as soon as possible in order to support the widest range of Internet clients, including tablets, computers and smartphones.

For private business Web applications running in a controlled environment, Microsoft recommended maintaining the current app in Silverlight 5 while planning a progressive migration to HTML5. For core business Web applications, Microsoft suggested migrating the presentation layer to HTML5 using ASP.NET SPA (Single Page Application) based on ASP.NET MVC and JavaScript libraries that can consume ASP.NET Web API services, which will allow the reuse of the current distributed services layer.

Microsoft also published a guide, Migrating Silverlight Applications to Windows Store apps.

Chris Bannon, product manager at Wijmo, a Pittsburgh-based user interface (UI) widget vendor, discussed converting Silverlight applications to HTML5 during a video tutorial. Wijmo used the MVVM pattern from Silverlight, which made it possible to port data access and UI layers easily. The transition process was also improved using tools like KnockoutJS and Wijmo.

In the long run, many developers who have fallen in love with Silverlight plan to continue to use it. As software developer Becky Isserman noted, "I think Silverlight is more mature and will stick around for a long time after Microsoft declares its death sentence. I think Microsoft might realize in the process that supporting it and maintaining it in the future might be worth it."

Dig Deeper on Silverlight and Expression application development