Skip to content

Getting ResourceBusyException while playing video on android 14 devices only. #1145

Closed

Description

@SurajBahadur

Version

Media3 1.1.1 / ExoPlayer 2.19.1

More version details

fatal Exception: java.lang.NoSuchMethodError: no non-static method "Landroid/media/ResourceBusyException;.<init>(Ljava/lang/String;III)V"
       at android.media.MediaDrm.provideKeyResponse(MediaDrm.java)
       at androidx.media3.exoplayer.drm.FrameworkMediaDrm.provideKeyResponse(FrameworkMediaDrm.java:266)
       at androidx.media3.exoplayer.drm.DefaultDrmSession.onKeyResponse(DefaultDrmSession.java:520)
       at androidx.media3.exoplayer.drm.DefaultDrmSession.access$100(DefaultDrmSession.java:61)
       at androidx.media3.exoplayer.drm.DefaultDrmSession$ResponseHandler.handleMessage(DefaultDrmSession.java:609)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at android.os.HandlerThread.run(HandlerThread.java:67)

Devices that reproduce the issue

Device running on android 14Android

Devices that do not reproduce the issue

Device running below android 14

Reproducible in the demo app?

No

Reproduction steps

In our app, We are playing DRM-protected video, and a few months ago, we migrated from Exoplayer to Media3. Now we have star getting the error on Firebase crashlytics. We are still not able to reproduce this issue.

fatal Exception: java.lang.NoSuchMethodError: no non-static method "Landroid/media/ResourceBusyException;.<init>(Ljava/lang/String;III)V"
       at android.media.MediaDrm.provideKeyResponse(MediaDrm.java)
       at androidx.media3.exoplayer.drm.FrameworkMediaDrm.provideKeyResponse(FrameworkMediaDrm.java:266)
       at androidx.media3.exoplayer.drm.DefaultDrmSession.onKeyResponse(DefaultDrmSession.java:520)
       at androidx.media3.exoplayer.drm.DefaultDrmSession.access$100(DefaultDrmSession.java:61)
       at androidx.media3.exoplayer.drm.DefaultDrmSession$ResponseHandler.handleMessage(DefaultDrmSession.java:609)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at android.os.HandlerThread.run(HandlerThread.java:67)
```Firebase

### Expected result

Video must be played on any android version.The videoAndroid

### Actual result

Keep getting the crash on every android 14 device randomly. 

### Media

https://play.google.com/store/apps/details?id=com.prepladder.learningapp

### Bug Report

- [ ] You will email the zip file produced by `adb bugreport` to android-media-github@google.com after filing this issue.

Activity

  1. self-assigned this
    on Mar 4, 2024
  2. icbaker commented on Mar 4, 2024

    @icbaker
    Collaborator

    The error is actually NoSuchMethodError while trying to construct a ResourceBusyException inside the DRM framework. This looks like the same issue as [internal b/291440132], except that was for NotProvisionedException instead. This was resolved by http://r.android.com/2770659, which looks like it should have fixed it for ResourceBusyException too. This fix wasn't included in the original Android 14 release, but should be included in QPR2: https://developer.android.com/about/versions/14/release-notes-qpr2


    Media3 has some special handling for ResourceBusyException. I will update this to also work for NoSuchMethodError where the message indicates we failed to construct a ResourceBusyException which should help to mitigate the issue:

    private static boolean acquisitionFailedIndicatingResourceShortage(DrmSession session) {
    return session.getState() == DrmSession.STATE_ERROR
    && checkNotNull(session.getError()).getCause() instanceof ResourceBusyException;
    }

  3. SurajBahadur commented on Mar 4, 2024

    @SurajBahadur
    Author

    @icbaker Helpful, Thank you for the udate.

  4. locked and limited conversation to collaborators on May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions