Android-components: Support DRM videos by overriding onPermissionRequest

Created on 22 Oct 2018  路  7Comments  路  Source: mozilla-mobile/android-components

In order to support DRM videos, WebChromeClient.onPermissionRequest needs to be overridden and the RESOURCE_PROTECTED_MEDIA_ID permission needs to be granted. Could you provide a callback so we can optionally show a dialog to accept or deny the permission?

Something like this:

override fun onPermissionRequest(request: PermissionRequest) {
       for (r in request.resources){
          if (r == PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID)
               ...
       }
}

See https://github.com/mozilla-mobile/firefox-tv/issues/787 for more context.

<engine-system> 馃専 feature 馃殌 Rocket

Most helpful comment

Okay, I prepared a patch and will open a PR.

I used this test page:
http://shaka-player-demo.appspot.com/demo/

Without the patch I can't select/play DRM content and with the patch that works.

All 7 comments

@st3fan we would like to have this in the next A-C release so we can get it into 3.1 build. cc @athomasmoz

Related to #1110.

@dnarcese Do you need a callback to handle this or do you always want to grant this request automatically?

@pocmo If it's not too much more work, a callback would be nice 馃檪 I think it's best to keep the option open for if we decide to show a dialog.

@pocmo If it's not too much more work, a callback would be nice 馃檪 I think it's best to keep the option open for if we decide to show a dialog.

Definitely! Was just wondering if it is needed now given that this seems to be a time sensitive request. :) - Handling onPermissionRequest (and the GeckoView equivalent) is something we definitely have on our list.

Ah yes, the callback isn't needed now - you can always put it on if the release can be had quicker and then build the callback later.

Okay, I prepared a patch and will open a PR.

I used this test page:
http://shaka-player-demo.appspot.com/demo/

Without the patch I can't select/play DRM content and with the patch that works.

Was this page helpful?
0 / 5 - 0 ratings