HLS+FairPlay stream playback sometimes fails with Safari on macOS when variants are not ordered by increasing bitrate

While setting up our premium video-on-demand workflow in AWS, using AWS MediaConvert and MediaPackager and licence delivery from drmToday we encountered an issue with HLS+FairPlay playback (only) in Safari on macOS. The issue is that sometimes (more than 50% on the same video) the videoplayer initialization fails (with simple event of type=”error” in onerror callback).

We are using Shaka player in our web application, so we first assumed that this (random) issue could be due to Shaka. However, we also tested with direct playback via the <video> player and we observed the same issue, with same frequency. Since we have some content for which this problem does not occur and other content when the problem occurs very frequently, we tried to understand what could explain this difference. We noticed that for assets where the problem never occurs the order of the video submanifest was increasing, whereas for assets where the problem occurs frequently the order is decreasing.

To isolate the issue we created a standalone page for a 2-minute asset and we are able to demonstrate that on this asset, when the bitrates are in decreasing order the playback with Safari on macOS fails more than 50% of the time.

Test page using <video> tag:

  • KO: https://ntg-test-public-scr.s3.eu-west-1.amazonaws.com/aws-video.html
  • OK: https://ntg-test-public-scr.s3.eu-west-1.amazonaws.com/aws-video.html?ok=1

Test page using Shaka:

  • KO: https://ntg-test-public-scr.s3.eu-west-1.amazonaws.com/aws-shaka.html
  • OK: https://ntg-test-public-scr.s3.eu-west-1.amazonaws.com/aws-shaka.html?ok=1

Notes:

  • the issue is only reproducible with Safari on macOS (not with Safari on iOS)
  • same HLS content + FairPlay plays OK 100% on tvOS
  • the issue is only reproducible for HLS content with FairPlay (OK if no DRM)