The patterns & practices group at Microsoft have just released a guide and reference implementation for a new project called Building an On-Demand Video Service with Microsoft Azure Media Services. As a team member of the project, and someone with an interest in the unique challenges of building video-on-demand services, I thought I'd describe the project.
What’s it all about?
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.
The 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, client applications are also available for Windows Phone, Web, iOS, and Android.
The 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 Windows 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 client applications, their integration with Azure Media Services, and the decisions made during the design and implementation, the guide discusses related factors, such as the design patterns used, and the ways that the application could be extended or modified for other scenarios.
The result is that, after reading the guide, 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.
What’s in the reference implementation?
The following diagram shows a high-level overview of the reference implementation.
Client applications communicate with the video-on-demand service through a REST web interface. This interface allows applications to retrieve, upload, and publish videos. When a video is uploaded for processing by Media Services it is stored in Microsoft Azure Storage, with the video details being stored in the CMS. It's then encoded to a set of adaptive bitrate MP4s, which can be converted by dynamic packaging to smooth streaming, HLS, or MPEG-DASH, on demand. For more information about dynamic packaging see Azure Media Services dynamic packaging.
When a video is consumed by applications, its URL is retrieved from the CMS and returned to the application. The application then requests the URL content from the Media Services Origin Service, which processes the outbound stream from storage to client app. For more information about the Origin Service, see Azure Media Services Origin Service.
The solution comprises three main components:
- The user facing client applications, implemented for the Windows Runtime, Windows Phone, Web, iOS, and Android. These applications allow users to browse videos, and control the playback of videos. In addition the applications allow users to capture and upload new videos for encoding by Media Services, which can then be consumed from the CMS once encoding has completed.
- The business logic, implemented as a web service. The Contoso web service exposes the data and operations that it supports through a REST interface. Separating the business logic in this way decouples it from the client applications, minimizing the impact that any changes to the implementation of the applications will have on this business logic.
- Data storage, provided by a Microsoft Azure SQL database, and by Microsoft Azure Storage. The CMS, which stores details of videos and encoding jobs, is implemented as a Microsoft Azure SQL database. However, uploaded videos and encoded videos output by Media Services are stored in Microsoft Azure Storage.
Who is it intended for?
The guide and reference implementation 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 content management systems.
Where can I get help?
Patterns for Scalable Media Hosting, like many patterns & practices deliverables, has a community site. On the community site you can post questions, provide feedback, connect with other users to share ideas, and find additional content such as extensions and training material. Community members can also help Microsoft plan and test future releases of Prism for the Windows Runtime. For more info see patterns & practices: Microsoft Azure Media Services Guidance.