amazon-chime-sdk-android
amazon-chime-sdk-android copied to clipboard
Running DefaultScreenCaptureSource(v0.17.10) on Android 14 and reporting an error
java.lang.IllegalStateException: Must register a callback before starting capture, to manage resources in response to MediaProjection states. at android.media.projection.MediaProjection.createVirtualDisplay(MediaProjection.java:206) at com.amazonaws.services.chime.sdk.meetings.audiovideo.video.capture.DefaultScreenCaptureSource.startInternal(DefaultScreenCaptureSource.kt:192) at com.amazonaws.services.chime.sdk.meetings.audiovideo.video.capture.DefaultScreenCaptureSource.access$startInternal(DefaultScreenCaptureSource.kt:49) at com.amazonaws.services.chime.sdk.meetings.audiovideo.video.capture.DefaultScreenCaptureSource$start$1.run(DefaultScreenCaptureSource.kt:113) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.os.HandlerThread.run(HandlerThread.java:67)
Sorry for the delay, is this log from running the demo app with the SDK? Did you observe the same error on previous OS versions?
It appears within our APP. For Android 13 or below, this error does not occur and the function is normal. On Android 14, this error occurred.
Compiler Environment: compileSdk 34 targetSdk 34
Phone:Pixel 5,OS 14
Sorry for the delay, is this log from running the demo app with the SDK? Did you observe the same error on previous OS versions?
This problem also occurs in the demo app. It should be an adaptation problem to Android 14. Thanks
@qinghua-pactera I would think so as well, will post updates once any.
when using targetSdk 34, it's required to register a callback before mediaProjection.createVirtualDisplay
.
add mediaProjection?.registerCallback(object : MediaProjection.Callback() {}, handler)
before mediaProjection?.createVirtualDisplay
in DefaultScreenCaptureSource.startInternal()
to fix.
https://developer.android.com/about/versions/14/behavior-changes-14#callback
@JasonChiAT Thanks for pointing out. Android team is crazy.
Is this going to be addressed this year? We have no issues downloading the source and just fixing it for now, but would prefer if there was an update from the aws team. Right now our Android 14 users are unable to do screen sharing because of this change that we completely missed when updating to the latest sdk.
Yes, we're working on that. Refer to https://github.com/aws/amazon-chime-sdk-android/commit/2eac126f3822d5ce6a1e3fa21f92054578a1fc58 for the fix, will update once it's been released.
oh thanks for the update. we did make a temp fix using the above suggestions. just forgot to update here. again thanks
Google has a deadline of 31st August, 2024 for all the apps to update their target sdk to Android 14. We have updated in our app but facing this issue while screen-sharing. Could you guys please let us know a timeline by when this issue will be addressed. Thanks.
https://support.google.com/googleplay/android-developer/answer/11926878?hl=en
I'm currently experiencing the issue mentioned in this thread when trying to run DefaultScreenCaptureSource
on Android 14 (API level 34). Given that Google requires all apps to target API 34 or above by August 31st, could you provide an estimated timeline for when the fix will be released? Thanks.
The fix is merged and pending release, will post a update when it's available.
Released in v0.23.0, note that there're breaking changes brought by Android 14, it'd be helpful to checkout the official post, and the CHANGELOG to apply the update on your application accordingly.