androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.69k stars 405 forks source link

Multiple DRM protection levels in DASH stream with low DRM protection level on device #1412

Closed cdongieux closed 5 months ago

cdongieux commented 5 months ago

Hi,

What's AndroidX Media3 behavior when playing a content with these conditions:

  1. a DASH stream with 2 video tracks (and some audio tracks, but it's not relevant here):
    1. a 1920x1080 HD track, protected with Widevine L1
    2. a 1280x720 SD track, protected with Widevine L3
  2. the device playing the stream is only Widevine L3 capable (emulator case)

Will the player fail when trying to play the HD track? Or will it ignore this track to automatically fallback to the SD track?

Best regards

icbaker commented 5 months ago

Have you tried it? That's likely the best way to get an authoritative answer on the behaviour.

cdongieux commented 5 months ago

I just did with the demo app, and the player fails with either android.media.MediaCodec$CryptoException: Error decrypting data: requested key has not been loaded: ERROR_DRM_NO_LICENSE or android.media.MediaCodec$CryptoException: Error decrypting data: insufficient output protection: ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION.

Is there any option in ExoPlayer I missed for it to handle that case? Or do you have any advice on how to handle it?

icbaker commented 5 months ago

This may be a duplicate of https://github.com/google/ExoPlayer/issues/4825, but the errors you report look different. Do you have a stream + DRM license server I can try that you can share here or email to to android-media-github@google.com with the subject Issue #1412? Please also update this issue to indicate you’ve done this.

cdongieux commented 5 months ago

I just sent an email with what you asked.

icbaker commented 5 months ago

Thanks, i tried using the provided info and initially hit a geo-block error. I resolved this by VPNing, but then hit a more generic code = 'unauthorized', msg = 'Missing Authorization' error. Is it possible the provided token has already expired?

cdongieux commented 5 months ago

The token is still valid. Are you sure the X-Fbx-Rights-Token HTTP header with the token value is included in the license request?

icbaker commented 5 months ago

Ah thanks for the hint, I had indeed missed wiring the headers in correctly - with that change I'm able to play content. And I also see the same error you report when playing on an emulator when the track selection switches up to the 1080p track.

I registered the listener discussed in https://github.com/google/ExoPlayer/issues/4825 and observe that 2/3 keys are reported as USABLE (0) and one is reported STATUS_OUTPUT_NOT_ALLOWED (2).

Given that, I'm going to mark this as a duplicate of that issue. In the meantime, you may want to manually query if a device has L1 support and if not then restrict the track resolution: https://developer.android.com/media/media3/exoplayer/track-selection#constraint-based-track

This made the stream play without failure for me in the demo app on an emulator:

player.setTrackSelectionParameters(
    player.getTrackSelectionParameters().buildUpon().setMaxVideoSize(1000, 600).build());