5

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() }
        }
    );
Eugene D. Gubenkov
  • 5,127
  • 6
  • 39
  • 71

1 Answers1

4

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.

Eugene D. Gubenkov
  • 5,127
  • 6
  • 39
  • 71
  • Hey, I'm working with the same thing and experiencing the same issues you mentioned... Using your code isn't solving it for me but one thing I can say is that my playback manifest url ends in manifest(encryption=cbc)... I used to add the apple format with a comma, like manifest(encryption=cbc,format=m3u8-aapl), but it's still failing... – Maximiliano Ambrosini Jun 14 '19 at 18:56
  • @MaximilianoAmbrosini, that's very interesting. Unfortunately, I'm not able to check it right now, but it was definitely a working approach for us. I would suggest to at least try to arrange the setup w/o encryption, just to eliminate another variable. – Eugene D. Gubenkov Jun 16 '19 at 04:30
  • Hey Eugene, it finally worked for me! even using encryption or not... it's basically the code you shared on pastebin, and on the client sending manifest(encryption=cbc,format=m3u8-aapl) for encrypted content. Looks like one thing that was preventing it to work was the iphone simulator, which has some problem with the audio. – Maximiliano Ambrosini Jul 03 '19 at 19:10
  • @MaximilianoAmbrosini, glad to hear! Good job! – Eugene D. Gubenkov Jul 05 '19 at 06:27
  • 1
    I implemented your workaround. Too bad this is still needed in 2020. Thanks! – Matt Apr 14 '20 at 13:19
  • @Matt sure, no problem, glad it worked for you too! – Eugene D. Gubenkov Apr 14 '20 at 16:36