Share via

Building an On-Demand Video Service with Microsoft Azure Media Services

patterns & practices Developer CenterDownload Reference ImplementationDownload book

April 2014

Microsoft Azure Media Services allows you to build media distribution solutions that can upload, encode, package, and stream media to multiple devices and platforms.

Traditionally, building the workflow for the creation, management, and distribution of media is problematic. It involves having to integrate multiple technologies and providers, some of which may be incompatible. In addition, it can require a huge investment in infrastructure, which may not always be fully utilized. These issues can result in a non-standardized workflow that is not easily scaled, and that requires coordination at different stages of the workflow.

Azure Media Services allow you to build scalable, cost effective, end-to-end media distribution solutions that can upload, encode, package, and stream media to Windows, iOS, Android, Adobe Flash, and other devices and platforms.

This guide describes how to design and build a video-on-demand application that uses Media Services. It provides an end to end walkthrough of a Windows Store application that communicates with Media Services through a web service, and explains key design and implementation choices.

In addition to the Windows Store application, the guide also includes client applications for Windows Phone, web, iOS, and Android devices. You can download the Windows client applications from the Microsoft Download Center. You can download the Android and iOS applications from the community site.

This guide describes:

  • The standard workflow of a media solution that uses Media Services.
  • How to use Media Services metadata in a content management system.
  • How to securely upload, process, and deliver media.
  • How to use Azure Storage Queues to control the encoding process.
  • How to deliver video-on-demand in multiple adaptive streaming formats in order to support client applications on different platforms and devices.
  • How to scale media encoding and delivery.

In addition to describing the Windows Store client application, its integration with the web service, and the decisions made during their design and implementation, this book discusses related factors, such as the design patterns used, and good practice for separating the presentation logic from the business logic of an application to avoid introducing dependencies between the two.

The result is that, after reading this guidance, you will be familiar with the basic principles of Media Services, and you will be able to design and implement client applications that use Media Services to provide scalable, cost effective, end-to-end media distribution solutions.

Download Code

Reference Implementation (Microsoft)

Reference Implementation (Android and iOS)

Download Book

Building an On-Demand Video Service with Azure Media Services (available in PDF, epub, and mobi formats)

Case Studies

Case Study: all3media

Case Study: blinkbox

Case Study: Xbox



Microsoft patterns & practices License

Who this guidance is for

This guidance is intended for architects, developers, and information technology professionals who design, build, or maintain video-on-demand or online video portal applications and services, particularly those that integrate with a content management systems. To understand the sample code provided with this guidance, you should be familiar with the Microsoft .NET Framework, the Microsoft Visual Studio development system, the Azure SDK for .NET, ASP.NET MVC, and the Microsoft Visual C# development language.

Why this guidance is pertinent now

Building the workflow for the creation, management, and distribution of media is problematic. It involves having to integrate multiple technologies and providers, some of which may be incompatible. In addition, it can require a huge investment in infrastructure, which may not always be fully utilized. These issues can result in a non-standardized workflow that is not easily scaled, and that requires coordination at different stages of the workflow.

Media Services provides everything you'll need to build and operate video-on-demand services to multiple devices and platforms, including all the tools and services you'll need to handle media processing, delivery, and consumption. In addition, Media Services will integrate with content management systems to help your platform scale by using the global footprint of Azure datacenters, without having to plan for capacity spikes or worry about idle datacenters. Together, this helps to reduce the costs that are associated with integrating multiple products and providers when building a media solution.

How this guidance is structured

The following figure shows the road map for the guide.

The guide structure

The guide structure



Chapter 1, "Introduction to Microsoft Azure Media Services"

This chapter provides an overview of the workflow used by Media Services, and discusses how to decide what type of media experience users should have.

Chapter 2, "The Azure Media Services Video-on-Demand Scenario"

This chapter describes the video content management system developed by Contoso, and the business requirements of the video applications, and summarizes the architecture of the solution that Contoso built, based on a web service that's consumed by client applications.

Chapter 3, "Uploading Video into Microsoft Azure Media Services"

This chapter describes the input formats supported by Media Services, how to use the Media Services SDK for .NET to upload content, and how to secure media for upload.

Chapter 4, "Encoding and Processing Video in Microsoft Azure Media Services"

This chapter focuses on encoding media, examining how to encode media for efficient delivery, how to create scalable encoding jobs, and how to control the encoding process by using Azure Storage Queues.

Chapter 5, "Delivering and Consuming Video from Microsoft Azure Media Services"

This chapter provides describes how to use dynamic packaging to convert video to the required format on-demand, how to scale media services delivery, and how to securely deliver streaming content to the end user.

This guide also includes the following appendices that describe how the web service works, and task presets you can use to configure the Azure Media Encoder:

What you need to use the code

These are the system requirements for building and running the sample solution:

  • Microsoft Windows 8.1.
  • Microsoft Visual Studio 2013 Ultimate, Premium, or Professional edition.
  • Azure SDK for .NET.
  • Windows Phone SDK 8.0.
  • Microsoft Internet Information Server (IIS).
  • A Media Services account in a new or existing Azure subscription.

Who’s who?

This guidance uses a sample application that illustrates consuming Media Services. A panel of experts comments on the development efforts. The panel includes a mobile app specialist, a software developer, a database specialist, and a cloud specialist. The delivery of the sample application can be considered from each of these points of view. The following table lists these experts.


Christine is a mobile application specialist. She understands the special requirements inherent in applications designed to be used on mobile devices. Her expertise is in advising architects and developers on the way they should plan the feature set and capabilities to make the application usable and suitable for these types of devices and scenarios.

"To build successful applications that work well on the phone, you must understand the platform, the user's requirements, and the environment in which the application will be used."


Markus is a senior software developer. He is analytical, detail oriented, and methodical. He's focused on the task at hand, which is building a great cloud-based application. He knows that he's the person who's ultimately responsible for the code.

"For the most part, a lot of what we know about software development can be applied to different environments and technologies. But, there are always special considerations that are very important."


Poe is a database specialist. He is an expert on designing and deploying databases. Poe has a keen interest in practical solutions; after all, he's the one who gets paged at 03:00 when there's a problem.

"Implementing databases that are accessed by thousands of users involves some big challenges. I want to make sure our database performs well, is reliable, and is secure. The reputation of Contoso depends on how users perceive the applications that access the database."


Bharath is a cloud specialist. He checks that a cloud-based solution will work for a company and provide tangible benefits. He is a cautious person, for good reasons.

“The cloud provides a powerful environment for hosting large scale, well-connected applications. The challenge is to understand how to use this environment to its best advantage to meet the needs of your business.”

If you have a particular area of interest, look for notes provided by the specialists whose interests align with yours.


This guide, like many patterns & practices deliverables, is associated with a community site. On this community site, you can post questions, provide feedback, or connect with other users for sharing ideas. Community members can also help Microsoft plan and test future guides, and download additional content such as extensions and training material.

Authors and contributors

This guide was produced by the following individuals:

  • Program and Product Management: Andrew Oakley (Microsoft Corporation)
  • Development: Martin Cabral (Southworks SRL), Ezequiel Jadib (Southworks SRL), Douglas McMurtry (AgileThought), Hanz Zhang (Microsoft Corporation)
  • Test: Monika Jadwani (Tata Consultancy Services), Sumit Jaiswal (Tata Consultancy Services), Gurunath Navale (Tata Consultancy Services), Kirpa Singh (Microsoft Corporation)
  • Documentation: David Britch (Content Master Ltd)
  • Edit: RoAnn Corbisier (Microsoft Corporation)
  • Illustrations and book layout: Chris Burns (Linda Werner & Associates Inc)
  • Release Management: Nelly Delgado (Microsoft Corporation)

Feedback and support

Questions? Comments? Suggestions? This content is a guidance offering, designed to be reused, customized, and extended. It is not a Microsoft product. Code-based guidance is shipped "as is" and without warranties. Customers can obtain support through Microsoft Support Services for a fee, but the code is considered user-written by Microsoft support staff.

Next Topic | Home | Community