Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
SurajBahadur opened this issue Mar 1, 2024 · 2 comments
Assignees

Comments

@SurajBahadur
Copy link

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.
@icbaker
Copy link
Collaborator

icbaker commented Mar 4, 2024

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;
}

@SurajBahadur
Copy link
Author

@icbaker Helpful, Thank you for the udate.

copybara-service bot pushed a commit that referenced this issue Mar 7, 2024
Issue: #1145

#minor-release

PiperOrigin-RevId: 613573868
copybara-service bot pushed a commit to google/ExoPlayer that referenced this issue Mar 7, 2024
SheenaChhabra pushed a commit that referenced this issue Apr 8, 2024
Issue: #1145

PiperOrigin-RevId: 613573868
(cherry picked from commit a604600)
l1068 pushed a commit to l1068org/media that referenced this issue Apr 15, 2024
Issue: androidx#1145

PiperOrigin-RevId: 613573868
(cherry picked from commit a604600)
@androidx androidx locked and limited conversation to collaborators May 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants