amazon-chime-sdk-android icon indicating copy to clipboard operation
amazon-chime-sdk-android copied to clipboard

Running DefaultScreenCaptureSource(v0.17.10) on Android 14 and reporting an error

Open qinghua-pactera opened this issue 1 year ago • 11 comments

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)

qinghua-pactera avatar Sep 19 '23 03:09 qinghua-pactera

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?

linsang21 avatar Oct 19 '23 22:10 linsang21

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

qinghua-pactera avatar Oct 20 '23 10:10 qinghua-pactera

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 avatar Nov 28 '23 05:11 qinghua-pactera

@qinghua-pactera I would think so as well, will post updates once any.

linsang21 avatar Jan 02 '24 19:01 linsang21

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 avatar Jan 12 '24 16:01 JasonChiAT

@JasonChiAT Thanks for pointing out. Android team is crazy.

gargVader avatar Jan 22 '24 15:01 gargVader

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.

pabloarista avatar Mar 11 '24 23:03 pabloarista

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.

linsang21 avatar Jun 11 '24 18:06 linsang21

oh thanks for the update. we did make a temp fix using the above suggestions. just forgot to update here. again thanks

pabloarista avatar Jun 11 '24 19:06 pabloarista

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

JanakMistry2000 avatar Jul 15 '24 08:07 JanakMistry2000

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.

lazarstep avatar Jul 26 '24 16:07 lazarstep

The fix is merged and pending release, will post a update when it's available.

linsang21 avatar Aug 08 '24 18:08 linsang21

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.

linsang21 avatar Aug 16 '24 17:08 linsang21