Eugene D. Gubenkov Eugene D. Gubenkov - 9 days ago 6
C# Question

Azure Media Player does not work with AES protection on iPhone

We are having issues playing a protected with AES (with JWT token authentication) video on iPhone 6 (A1586). The following error arrears:


0x50300000 - The video playback was aborted due a corruption problem
or because the video used features your browser did not support


The very same video plays w/o any problems when encryption is disabled.

The thing is that the sample that replicates such scenario published by Azure Media Player team does not work either and fails with the very same error! It's available here: https://ampdemo.azureedge.net/. This sample named as follows:


AES (JWT token) – On Demand [Tears of Steel Teaser]


How can I do protected video streaming via Azure media Services/Player on iPhone? Is it supported scenario at all?

Here is the relevant code that sets up the delivery policy:

deliveryPolicy = context.AssetDeliveryPolicies.Create(
DeliveryPolicyName,
AssetDeliveryPolicyType.DynamicEnvelopeEncryption,
AssetDeliveryProtocol.SmoothStreaming | AssetDeliveryProtocol.Dash | AssetDeliveryProtocol.HLS,
new Dictionary<AssetDeliveryPolicyConfigurationKey, string>
{
{ AssetDeliveryPolicyConfigurationKey.EnvelopeKeyAcquisitionUrl, contentKey.GetKeyDeliveryUrl(ContentKeyDeliveryType.BaselineHttp).ToString() }
}
);

Answer

Just found this exact scenario in the list of Azure Media Player "known issues": https://amp.azure.net/libs/amp/latest/docs/Known_Issues.html.

AES and restricted token content does not playback using iOS and older Android devices. In order to achieve this scenario, a proxy must be added to your service.

This workaround that is proposed by Azure team is described in this article: https://azure.microsoft.com/en-us/blog/how-to-make-token-authorized-aes-encrypted-hls-stream-working-in-safari/. I did not personally test it yet.

workaround

UPDATE. The workaround works after minor changes -- there was an issue with URL encoding for second-level HLS playlist. Here is full WebAPI 2 controller code that makes the trick for me: http://pastebin.com/kq7Zfw88.

Comments