Azure Media Player 在 iPhone 上无法使用 AES 保护

Azure Media Player does not work with AES protection on iPhone

我们在 iPhone 6 (A1586) 上播放受 AES(使用 JWT 令牌身份验证)保护的视频时遇到问题。以下错误欠费:

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

同一视频播放 w/o 禁用加密时出现任何问题。

问题是 sample 复制了 Azure Media Player 团队发布的这种场景 也不起作用 并且失败了同样的错误!可在此处获取:https://ampdemo.azureedge.net/。本样本命名如下:

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

如何在 iPhone 上通过 Azure 媒体 Services/Player 进行受保护的视频流?完全支持场景吗?

这里是设置传递策略的相关代码:

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

刚刚在 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.

这篇文章描述了 Azure 团队提出的解决方法:https://azure.microsoft.com/en-us/blog/how-to-make-token-authorized-aes-encrypted-hls-stream-working-in-safari/。我还没有亲自测试过。

更新。 稍作更改后解决方法有效——二级 HLS 播放列表的 URL 编码存在问题。这是对我有用的完整 WebAPI 2 控制器代码:http://pastebin.com/kq7Zfw88.