How to choose dash/hls DRM url based on what browser you are on?

Sturla 176 Reputation points
2021-11-27T17:11:30.903+00:00

Ok I have coded my API to return two urls

  • Dash url (PlayReady and Widevine)
  • HLS URL (FairPlay)

and both have attached bearer token and if I just use the Dash URL with Azure Media Player in Edge it works just fine.

But what if

  1. I´m on different browsers and devices? Say Safari on IPhone? Then I can´t use Dash and need to provide Hls.
  2. How do I toggle between using different URLs?
  3. Do I have to detect what browser/device I´m on and swap them out?

As a side question/info I was going to go with hls.js rather than AMP (as suggested here as an option by @John Deutscher (MSFT) ) but it doesn´t seem to be supported either by Widevine or FairPlay (I´m not quite understanding that though...).

But now I´m thinking about using Shaka Player and there I have the same problem of how to best support all browsers in my code.

Dash vs Hls as I understand it
Dash = PlayReady (Microsoft) and Widevine (Google) for Microsoft Edge, Internet Explorer 11 Chrome,Firefox and Opera)
Hls = FairPlay (Apple) for Safari,iOS 11 or later,iPhone 8 or later macOS High Sierra with Intel 7th Generation CPU)

Community Center | Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. David Bristol 971 Reputation points Microsoft Employee
    2021-12-01T19:44:35.797+00:00

    The reason Azure Media Player works in your scenario is that it does browser detection to determine video playback capabilities and then use the appropriate adaptive streaming protocol (HLS, MPEG-DASH, or Smooth Streaming) that work with those capabilities. AMP understands the Azure Media Services format tag, as documented on https://learn.microsoft.com/en-us/azure/media-services/previous/media-services-deliver-content-overview#URLs. However, for other players you would need to explicitly set the format tag. If you use a third party player typically you will need to specify a specific protocol since the Azure Media Services format tag is Media Services specific. You may need to do browser detection depending on the player you use to pass it the appropriate URL.

    Shaka Player lists both the 'Platform and browser support matrix' as well as the 'DRM support matrix' on https://github.com/google/shaka-player. Incidentally, Azure Media Player has a similar compatibility matrix on https://learn.microsoft.com/en-us/azure/media-services/azure-media-player/azure-media-player-playback-technology#compatibility-matrix. There are also some good docs at https://github.com/google/shaka-player/blob/master/docs/tutorials/drm-config.md on how to do DRM with Shaka on the Shaka side and https://learn.microsoft.com/en-us/azure/media-services/latest/player-shaka-player-how-to on the Azure Media Services side.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.