google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.73k stars 6.03k forks source link

Green screen after transition between the Ads to the Main Content #7640

Closed sky-uiltonsantos closed 4 years ago

sky-uiltonsantos commented 4 years ago

[REQUIRED] Issue description

We are facing an error that only occurs in Androids version 5.0 (API 21).

This is the scenario: after playing an Advert when the player switches to the Main Content (DRM Widevine) We get a non-recoverable green screen. This is only occurring in Android 5 (we tested in Samsung SM-N9005 and Motorola Moto G).

The interesting part is: the bug does not appear in Portrait mode, only in Landscape mode.

It is possible to reproduce on the Exoplayer Sample-app, but it was not possible to reproduce using included sample assets.

[REQUIRED] Reproduction steps

On Exo's sample app, add this asset to media.exolist.json

  1. { "name": "Green Screen Test", "samples": [ { "name": "Green Screen test", "uri": "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd", "ad_tag_uri": "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=", "drm_scheme": "widevine", "drm_license_url": "https://widevine-proxy.appspot.com/proxy" } ] }

  2. Override the Ads to play a custom Ads: ImaAdsLoader.java -> Method: loadAd -> Use this URL inside of Uri.parse "https://mssl.fwmrm.net/m/1/169843/27/6925211/OMFM9518000H_ENT_MEZZ_HULU_2045855_649/master_cmaf.mpd"

  3. After doing the setup above, build the Sample-app with withExtensionsDebug

  4. Just play the added asset and watch the Ads and main content.

Expected Behavior Play fine without a green screen

Actual Behavior After the end of the Ads, the main content shows up on a green screen. It's recoverable if you rotate the screen.

[REQUIRED] Link to test content

{ "name": "Green Screen Test", "samples": [ { "name": "Green Screen test", "uri": "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd", "ad_tag_uri": "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=", "drm_scheme": "widevine", "drm_license_url": "https://widevine-proxy.appspot.com/proxy" } ] }

[REQUIRED] A full bug report captured from the device

bugreport.txt

Video showing the bug: https://www.dropbox.com/s/mpfu2zr0sugb1ud/IMG_3148.MOV?dl=0

[REQUIRED] Version of ExoPlayer being used

[REQUIRED] Device(s) and version(s) of Android being used

AquilesCanta commented 4 years ago

Sorry, hadn't seen this. I'll take a look. By chance have you been able to reproduce on newer Android versions? If this is a platform issue that was fixed on a later Android version there is not much we can do on the ExoPlayer side.

AquilesCanta commented 4 years ago

The issue is not reproducible on Pixel devices running R. And I don't have the mentioned devices. Could you confirm whether:

sky-uiltonsantos commented 4 years ago

Hi @AquilesCanta, answering your questions:

Can you give some light around this issue? Could you reproduce on your ends?

Thank you.

AquilesCanta commented 4 years ago

This is a tricky situation because, considering it's been fixed in later Android versions, this was probably a platform issue which was later fixed.

The only workaround I can think of right now is trying placeholder DRM sessions for the ads. I suspect this might not be possible right now, but I'm working on it and will reach back once that's possible.

Can you give some light around this issue?

I don't think I know more than you about the cause of this issue. This is device and android version specific. Unlikely it's related to ExoPlayer.

Could you reproduce on your ends?

I haven't been able. And I don't have the mentioned devices.

@andrewlewis:

sky-uiltonsantos commented 4 years ago

A curiosity thing:

My suspicious is the SurfaceView, during the transition to the Ads (non-protect) to the main content (protected).

AquilesCanta commented 4 years ago

So something I would like to try (please do it for me, since you have the devices) is using a secure decoder for both clear and encrypted content, just in case we notice something different. To do this, customize this line in the AdsMediaSource to use a DRM session for clear periods, like so:

MediaSource adMediaSource =
    adMediaSourceFactory.createMediaSource(
        new MediaItem.Builder()
            .setUri(adUri).setDrmUuid(C.WIDEVINE_UUID).setDrmSessionForClearPeriods(true).build());

And let me know if you observe any difference. What you want to check is that the renderers are using a DrmSession when playing ad and content. The result is that the same decoder should be used for both. Also, kindly provide a logcat dump both with and without this workaround shortly after reproducing the issue.

Edit: To make this change, please checkout the dev-v2 branch.

sky-uiltonsantos commented 4 years ago

Hey, I was trying to test what you suggested, but I am facing the following error: image

So, on that branch (dev-v2) the class C cannot find any properties on there.

What is missing on my ends?

AquilesCanta commented 4 years ago

I'm inclined to think that something went wrong when you were checking out the code. I'd advise you try on a fresh checkout:

$ cd # wherever you want to put the ExoPlayer code.
$ git clone git@github.com:google/ExoPlayer.git
$ cd ExoPlayer
$ git checkout dev-v2

And then add the suggested modifications.

AquilesCanta commented 4 years ago

@andrewlewis noticed that the error suggests that you are defining an int called C somewhere in your program scope.

sky-uiltonsantos commented 4 years ago

@AquilesCanta doing the suggestion above

 MediaSource adMediaSource =
            adMediaSourceFactory.createMediaSource(
                new MediaItem.Builder()
                    .setUri(adUri).setDrmUuid(C.WIDEVINE_UUID).setDrmSessionForClearPeriods(true).build());

I still get the green screen 😞

AquilesCanta commented 4 years ago

At this point there is not much I can do, since this is an issue I cannot reproduce in an old version of an old device which I don't have. I can't really think of a workaround we could add in the library either. Perhaps someone in my team can think of something.

That being said, something I would try would be listening for onRenderedFirstFrame and, when that happens, you can recreate the surface to which you are rendering. My idea is to take advantage of what you said:

It's recoverable if you rotate the screen.

I'm guessing that the screen rotation is recreating the surface, which fixes the issue. So if you manually recreate the surface at the first frame after the ad, the content should fix itself. You should implement onRendereredFirstFrame and play around to see if you can fix the content as soon as it starts.

AquilesCanta commented 4 years ago

Please let me know if you managed to work out a solution using the info in the comment above.

I'll close this issue now. I'm happy to reopen if you comment below.