In my previous posts, I have answered in details the following questions:
- Does Azure Media Services provide Video Analytics or User Analytics? For the detailed answer, please see this blog.
- Does Azure Media Services support VR/360 live streaming? For detailed answer, please see this blog.
In this post, I will answer the following question:
Does Azure Media Services support offline download/playback with DRM protection?
Again the answer is yes.
First, some background info on offline mode playback, especially why:
- In some countries, Internet availability and/or bandwidth is still limited. Users may choose to download first to be able to watch content in high enough resolution for satisfactory viewing experience. In this case, more often, the issue is not network availability, rather it is limited network bandwidth. OTT/OVP providers are asking for offline mode support.
- As disclosed at Netflix 2016 Q3 shareholder conference, downloading content is a “oft-requested feature”, and “we are open to it” said by Reed Hastings, Netflix CEO.
- Some content providers may disallow DRM license delivery beyond a country's border. If a user needs to travel abroad and still wants to watch content, offline download is needed.
The challenge we face in implementing offline mode is the following:
- MP4 is supported by many players, encoder tools, but there is no binding between MP4 container and DRM;
- In the long term, CFF with CENC is the way to go. However, today, the tools/player support ecosystem is not there yet. We need a solution, today.
The idea is: smooth streaming (PIFF) file format with H264/AAC has a binding with PlayReady (AES-128 CTR). Individual smooth streaming .ismv file (assuming audio is muxed in video) is itself a fMP4 and can be used for playback. If a smooth streaming content goes through PlayReady encryption, each .ismv file becomes a PlayReady protected fragmented MP4. We can choose a .ismv file with the preferred bitrate and rename it as .mp4 for download.
There are two options for hosting the PlayReady protected MP4 for progressive download:
- One can put this MP4 in the same container/media service asset and leverage Azure Media Services streaming endpoint for progressive download;
- One can use SAS locator for progressive download directly from Azure Storage, bypassing Azure Media Services.
Of course, you have the liberty of using two types of PlayReady license delivery:
- PlayReady license delivery service in Azure Media Services;
- PlayReady license servers hosted anywhere.
Below are two sets of test assets, the first one using PlayReady license delivery in AMS while the second one using my PlayReady license server hosted on an Azure VM:
- Progressive download URL: http://willzhanmswest.streaming.mediaservices.windows.net/8d078cf8-d621-406c-84ca-88e6b9454acc/20150807-bridges-2500_H264_1644kbps_AAC_und_ch2_256kbps.mp4
- PlayReady LA_URL (AMS): https://willzhanmswest.keydelivery.mediaservices.windows.net/PlayReady/
- Progressive download URL: http://willzhanmswest.streaming.mediaservices.windows.net/7c085a59-ae9a-411e-842c-ef10f96c3f89/20150807-bridges-2500_H264_1644kbps_AAC_und_ch2_256kbps.mp4
- PlayReady LA_URL (on-prem): https://willzhan12.cloudapp.net/playready/rightsmanager.asmx
For playback testing, I used a Universal Windows Application on Windows 10. In Windows 10 Universal samples, there is a basic player sample called Adaptive Streaming Sample. All we have to do is to add the code for us to download video and use it as the source, instead of adaptive streaming source. The changes are in button click event handler:
private async void LoadUri_Click(object sender, RoutedEventArgs e)
//if (!Uri.TryCreate(UriBox.Text, UriKind.Absolute, out uri))
// Log("Malformed Uri in Load text box.");
//LoadSourceFromUriTask = LoadSourceFromUriAsync(uri);
//willzhan change start
// Create and open the file picker
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder;
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
//rootPage.NotifyUser("Picked video: " + file.Name, NotifyType.StatusMessage);
this.mediaPlayerElement.MediaPlayer.Source = MediaSource.CreateFromStorageFile(file);
UriBox.Text = file.Path;
// rootPage.NotifyUser("Operation cancelled.", NotifyType.ErrorMessage);
// On small screens, hide the description text to make room for the video.
DescriptionText.Visibility = (ActualHeight < 500) ? Visibility.Collapsed : Visibility.Visible;
Of course, since the video is under PlayReady protection, the screenshot will not be able to include the video.
In summary, we have achieved offline mode on Azure Media Services:
- Content transcoding and PlayReady encryption can be done in Azure Media Services or other tools;
- Content can be hosted in Azure Media Services or Azure Storage for progressive download;
- PlayReady license delivery can be from Azure Media Services or elsewhere;
- The prepared smooth streaming content can still be used for online streaming via DASH or smooth with PlayReady as the DRM.
What about HLS protected by FairPlay? You can check the new Apple's protected offline mode offering in this video (14 minutes into the video is on offline mode). Notice that this video is in HLS, so you need to use a browser which supports HLS, such as Microsoft Edge on Windows 10, or Safari on OS X.
ACKNOWLEDGMENT: Special acknowledgment goes to Nick Drouin of Windows & Devices, Quintin Burns and Anil Murching of Azure Media Services team for their technical insights, guidance and great help.