Cannot play DRM protected video streams on Webview2

Viewed 277

I created WinUI 3.0 project that used Webview2 v1.0.818.41 and loaded my video streaming app into it, but the video will not play and reports multiple DRM errors.

I also checked if video streaming works for the app in the version of Chromium Edge I have installed on my computer, and it does. Here is my user agent string, which I verified matches the user agent string I get from Webview2:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 Ege/90.0.818.62

After a bit of investigation, I figured out that navigator.requestMediaKeySystemAccess is defined on Chromium Edge but is not defined on the client in Webview2. Because this is a UWP app, I suspect one of four possibilities as to why DRM fails:

  1. Developer mode?
    • I know previously that Legacy Edge running on an Xbox One in developer mode restricts playback of DRM content to SL-150 and below. Could this be true of Webview2, but even more restrictive than Legacy Edge?
  2. Missing app permission or some other setting?
    • I have set the content URI's in the manifest appropriately, and nothing appears out of sorts with the app permissions.
  3. Webview2 does not have EME support yet?
    • If true, this is surprising since EME is a W3C specification, and support is already built into Chromium Edge.
  4. Webview2 needs instantiation with some unspecified options/flags?

Of relevant importance, I should also note that I have seen other video streaming apps using Webview2. The only way I can tell is when an error occurs, but I have seen error messages on those apps that indicate the new component is in use, so I know DRM has somehow been figured out.

1 Answers

I was able to identify that the root cause of this issue was a 3rd party tool not properly handling streams. However, I did discover the following along the way:

  1. Webview2 does support EME as of v1.0.818.41
  2. Developer mode does not affect the ability to play DRM protected content
  3. URLs must use HTTPS, not HTTP or else navigator.requestMediaKeySystemAccess is undefined.
  4. No special app permissions or flags on Webview2 are required
Related