mozilla-mobile / fenix

⚠️ Fenix (Firefox for Android) moved to a new repository. It is now developed and maintained as part of: https://github.com/mozilla-mobile/firefox-android
https://github.com/mozilla-mobile/firefox-android
Mozilla Public License 2.0
6.47k stars 1.27k forks source link

Support for Widevine EME DRM #1175

Closed cpeterso closed 3 years ago

cpeterso commented 5 years ago

Existing EME work:

Why/User Benefit/User Problem

Users would like to be able to watch videos that use DRM.

What / Requirements

Fenix has EME UI to play Widevine DRM videos.

We do not need EME for Fenix MVP or the Fennec/Fenix transition because Fennec does not currently support EME. Fenix EME can wait until FFTV ships its EME UI first (mozilla-mobile/firefox-tv#1698).

Acceptance Criteria (how do I know when I’m done?)

Users can watch YouTube and Amazon Prime videos that use Widevine DRM.

The following YouTube DRM video is a convenient test case for EME because it costs $0 (though you still need a credit card to "purchase" the video): https://www.youtube.com/watch?v=W6E7CGm12tA

┆Issue is synchronized with this Jira Task

ghost commented 5 years ago

Widevine support would be great!

ghost commented 5 years ago

The following YouTube DRM video is a convenient test case for EME because it costs $0 (though you still need a credit card to "purchase" the video): https://www.youtube.com/watch?v=W6E7CGm12tA

How about this one for Widevine test instead? (Doesn't require an account)

cpeterso commented 5 years ago

More GV bugs: https://bugzilla.mozilla.org/show_bug.cgi?id=1524091 https://bugzilla.mozilla.org/show_bug.cgi?id=1506924

dbolter commented 4 years ago

Note: I think Firefox brand policy would want us to ask or notify the user when DRM is used (even if part of android system). Do we have any fenix Ux started on that front? (Is this the right issue for this topic)

miketaylr commented 4 years ago

It looks like Starz relies on Widevine: https://github.com/webcompat/web-bugs/issues/52232#issuecomment-620563246

ziddey commented 4 years ago

It's been implied above that permission needs to be granted for EME but support is missing.

Can confirm that in the current android beta/nightly, widevine works swimmingly by setting media.eme.enabled to true and media.eme.require-app-approval to false in about:config.

liuche commented 4 years ago

Hi QA, we want to restart this work, so could you test to see if the user's comment above^ allows playing DRM content, on Beta or Nightly with those settings updated?

Possible sites to test (from the comments in this issue):

Specifically, would like to know in what cases this content can be played (if at all). If the technical capabilities are there, perhaps all we need is to add settings in UI.

Diana-Rus commented 4 years ago

Hello, checked the following outcomes with Google Pixel 3 XL (Android 9) and Samsung Galaxy S9 (Android 8) on Nightly 7/27.

Scenario 1

Scenario 2

Scenario 3 - Default Firefox Nightly Settings

Scenario 4

Scenarios Details **Scenario 1** 1.1 For https://bitmovin.com/demos/drm - ![Screenshot_20200728-115051](https://user-images.githubusercontent.com/49859863/88668065-d1dbf780-d0ea-11ea-98d0-059e2c237d11.png) 1.2 For https://www.starz.com/us/en/play/58958 - ![Screenshot_20200728-115415](https://user-images.githubusercontent.com/49859863/88668104-da343280-d0ea-11ea-9868-b33bf775ff0a.png) **Scenario 2** 2.1 For https://bitmovin.com/demos/drm - ![Screenshot_20200728-111329](https://user-images.githubusercontent.com/49859863/88667113-9e4c9d80-d0e9-11ea-906b-a1029eadfe6c.png) 2.2 For https://www.starz.com/us/en/play/58958 - ![Screenshot_20200728-111727](https://user-images.githubusercontent.com/49859863/88667101-9a208000-d0e9-11ea-94c2-903850cfbaf1.png) **Scenario 3 - Default Firefox Nightly Settings** 3.1 For https://bitmovin.com/demos/drm - same outcome is present as for scenario 2 3.2 For https://www.starz.com/us/en/play/58958 - same outcome is present as for scenario 2 **Scenario 4** 4.1 For https://bitmovin.com/demos/drm - same outcome is present as for scenario 2 4.2 For https://www.starz.com/us/en/play/58958 - same outcome is present as for scenario 2

Notes:

  1. Will the GV issue be treated in this one? media.eme.require-app-approval when is set to true and media.eme.enabled is true, there is no notification or prompt about allowing or disallowing to play DRM content
  2. Does the UI of Fenix be changed other than the Permission module (as described in the Google Doc from description)? Will there be other parts affected in Fenix?
  3. Should the video eme keys be displayed when media.eme.require-app-approval is set to false, or in case from permission level, the user denies the api's request?
  4. Are the error mentioned at scenario 1 supposed to happen?

@liuche - as we discussed on slack, related to the youtube video, i did encounter some problems. I'll check to see for a video that will work in my country. I'll let you know about that. I'll remove the qa-needed until further information is provided.

ziddey commented 4 years ago

@Diana-Rus scenario 1 is the only relevant case. I'm assuming your test devices are able to play the bitmovin widevine test with Chrome?

On my end, I've confirmed working (current beta and nightly):

Screenshot_20200728-142137

DRM Info

Do not have any Android 8/9 devices on hand to test

cpeterso commented 4 years ago

Google has a streaming video test page for their "Shaka Player" that includes EME/DRM videos. The "Clear Key DRM" and "Widevine DRM" videos should all work in Firefox and Chrome on desktop and mobile. "Fairplay DRM" is only supported in Safari. "PlayReady DRM" is only supported in Edge (including Chromium Edge).

https://shaka-player-demo.appspot.com/demo/#audiolang=en;textlang=en;uilang=en;panel=ALL_CONTENT;build=uncompiled

Diana-Rus commented 4 years ago

Hi, @ziddey - yes, the test devices are able to play the bitmovin widevine test using Chrome(84.0.4147.89).

@cpeterso - thanks Chris, i've looked the videos from https://shaka-player-demo.appspot.com/demo/#audiolang=en;textlang=en;uilang=en;panel=ALL_CONTENT;build=uncompiled with widevine DRM and clear key DRM

@liuche - could you please check the questions form above comment, thank you!! Could you also look at the outcomes below?

Scenarios have been checked with Google pixel 3 XL (Android 9) and Samsung Galaxy S9 (Android 8) on Nightly 7/27 Scenario 1 - media.eme.enabled - true and media.eme.require-app-approval - false

A) Widevine DRM:

B) ClearKey DRM:

liuche commented 4 years ago
1. Will the GV issue be treated in this one? media.eme.require-app-approval when is set to true and media.eme.enabled is true, there is no notification or prompt about allowing or disallowing to play DRM content

Okay, I think this requires us to use the GeckoView APIs that exist for EME, and once we implement handling that permission, then the notification will show up.

2. Does the UI of Fenix be changed other than the Permission module (as described in the Google Doc from description)? Will there be other parts affected in Fenix?

I don't think that we will need to change the Fenix UX, beyond showing a dialog asking the user to accept/reject.

3. Should the video eme keys be displayed when media.eme.require-app-approval is set to false, or in case from permission level, the user denies the api's request?

If the approval is set to false, or the user does not approve the api request, then I do not believe the key should show.

4. Are the error mentioned at scenario 1 supposed to happen?

Interesting, if we never hit that code path, we shouldn't have to hit the permission, so now that you mention it, that doesn't seem quite right.

EDIT: I tested this on my Nightly Fenix version with the bitmovin, and I did not see that error. Is the error still present if refreshing the bitmovin page?


Thank you @Diana-Rus for the thorough testing, and helping us understand the current state of EME in Fenix. We will do some more work, and then re-request QA.

liuche commented 4 years ago

Next steps here:

After talking to Randall Barker from the FxR team in the #geckoview channel, it sounds like the next steps will require a little AC work to trigger the EME notification and permissions.

We'll need to add and handle the GeckoSession.PermissionDelegate.PERMISSION_MEDIA_KEY_SYSTEM_ACCESS permission in GeckoPermissionRequest

See the FxR implementation.

This probably needs some strings for the prompt, but we should be able to at least see if it works (and what context this shows up in).

kbrosnan commented 4 years ago

So this was broken on Nightly from July-17 by bz-1652474. Randal opened bz-1656289 to fix this, we should re-test when this is fixed.

liuche commented 4 years ago

@kbrosnan this seems like it could be a good candidate for Hershey next sprint, what do you think? We'll need strings for the require-app-approval prompt though - if you know what that prompt should ask for, we can pass that on to @betsymi and get strings from her.

kbrosnan commented 4 years ago

Randal's bug fixing EME on Android has been merged into mozilla-central. When we get a GV with a build id greater than 20200804000001 (2020-08-04-000001) this can be tested again.

Diana-Rus commented 4 years ago

Hi, with Nightly 8/10 build that contains the eme enabling, the media.eme.enabled is set true as default in comparison with the last tested build.

@kbrosnan i understood from @liuche that there is another eme issue that will be in a later GV build, do you know which one is it?

I'll remove the qa-needed until further information is provided.

Diana-Rus commented 4 years ago

Hello @kbrosnan, @liuche , any news for this issue 😊?

emilio commented 3 years ago

With https://github.com/mozilla-mobile/android-components/pull/9121 this works for me on my local build at least :)

LaurentiuApahideanSV commented 3 years ago

Verified as fixed on Firefox Preview Nightly 201214 (Build #2015781291)

Devices used: