Replies: 2 comments
-
Hi @pp1137 , Let's follow up issue above so I'm closing this discussion. BTW, We schedule the issues according to our availability and their priorities. Cheers |
Beta Was this translation helpful? Give feedback.
-
I tested the sample Android SDK screen share application with target version 34, and it appears to be working properly on my end; my Android version is 13, and my device is a Samsung S20 FE.
Do you have any specific scenarios in which it is not working? Also, are you testing with the default application settings on the AMS side, and what is your Android version? |
Beta Was this translation helpful? Give feedback.
-
When i used sample code and upgrade project to targetSdkVersion 34 and click on screens from ScreenCaptureActivity and its crashing and in targetSdkVersion 33 its working fine but in play store we need targetSdkVersion 34
Crash logs
Process: io.antmedia.webrtc_android_sample_app, PID: 10603
java.lang.RuntimeException: Unable to create service io.antmedia.webrtc_android_sample_app.basic.MediaProjectionService: java.lang.SecurityException: Starting FGS with type mediaProjection callerApp=ProcessRecord{bbc5102 10603:io.antmedia.webrtc_android_sample_app/u0a437} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION] any of the permissions allOf=false [android.permission.CAPTURE_VIDEO_OUTPUT, android:project_media]
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4773)
at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2335)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:334)
at android.app.ActivityThread.main(ActivityThread.java:8293)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1053)
Caused by: java.lang.SecurityException: Starting FGS with type mediaProjection callerApp=ProcessRecord{bbc5102 10603:io.antmedia.webrtc_android_sample_app/u0a437} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION] any of the permissions allOf=false [android.permission.CAPTURE_VIDEO_OUTPUT, android:project_media]
at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6966)
at android.app.Service.startForeground(Service.java:862)
at io.antmedia.webrtc_android_sample_app.basic.MediaProjectionService.onCreate(MediaProjectionService.java:52)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4760)
at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2335)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:334)
at android.app.ActivityThread.main(ActivityThread.java:8293)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1053)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2611)
at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2322)
at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1679)
at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:13667)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3485)
Added below permissions
Crashed app logs :
java.lang.RuntimeException: Unable to start service io.antmedia.webrtc_android_sample_app.basic.MediaProjectionService@b85f94 with Intent { cmp=com.ember.video/io.antmedia.webrtc_android_sample_app.basic.MediaProjectionService (has extras) }: java.lang.SecurityException: Don't re-use the resultData to retrieve the same projection instance, and don't use a token that has timed out. Don't take multiple captures by invoking MediaProjection#createVirtualDisplay multiple times on the same instance.
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4948)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2360)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:334)
at android.app.ActivityThread.main(ActivityThread.java:8293)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1053)
Caused by: java.lang.SecurityException: Don't re-use the resultData to retrieve the same projection instance, and don't use a token that has timed out. Don't take multiple captures by invoking MediaProjection#createVirtualDisplay multiple times on the same instance.
at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at android.hardware.display.IDisplayManager$Stub$Proxy.createVirtualDisplay(IDisplayManager.java:1425)
at android.hardware.display.DisplayManagerGlobal.createVirtualDisplay(DisplayManagerGlobal.java:643)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1140)
at android.media.projection.MediaProjection.createVirtualDisplay(MediaProjection.java:247)
at android.media.projection.MediaProjection.createVirtualDisplay(MediaProjection.java:216)
at org.webrtc.ScreenCapturerAndroid.createVirtualDisplay(ScreenCapturerAndroid.java:210)
at org.webrtc.ScreenCapturerAndroid.startCapture(ScreenCapturerAndroid.java:134)
at io.antmedia.webrtcandroidframework.core.WebRTCClient.createVideoTrack(WebRTCClient.java:2341)
at io.antmedia.webrtcandroidframework.core.WebRTCClient.changeVideoCapturer(WebRTCClient.java:1754)
at io.antmedia.webrtcandroidframework.core.WebRTCClient.changeVideoSource(WebRTCClient.java:1198)
at io.antmedia.webrtc_android_sample_app.advanced.ConferenceActivityWithSpeakerIndicator.startScreenCapturer(ConferenceActivityWithSpeakerIndicator.java:1341)
at io.antmedia.webrtc_android_sample_app.advanced.ConferenceActivityWithSpeakerIndicator.lambda$onActivityResult$4$io-antmedia-webrtc_android_sample_app-advanced-ConferenceActivityWithSpeakerIndicator(ConferenceActivityWithSpeakerIndicator.java:1298)
at io.antmedia.webrtc_android_sample_app.advanced.ConferenceActivityWithSpeakerIndicator$$ExternalSyntheticLambda2.mediaProjectionOnSuccess(Unknown Source:2)
at io.antmedia.webrtc_android_sample_app.basic.MediaProjectionService.onStartCommand(MediaProjectionService.java:72)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4930)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2360)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:334)
at android.app.ActivityThread.main(ActivityThread.java:8293)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1053)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.isValid(MediaProjectionManagerService.java:1097)
at com.android.server.display.DisplayManagerService.createVirtualDisplayInternal(DisplayManagerService.java:1469)
at com.android.server.display.DisplayManagerService.-$$Nest$mcreateVirtualDisplayInternal(DisplayManagerService.java:0)
at com.android.server.display.DisplayManagerService$BinderService.createVirtualDisplay(DisplayManagerService.java:3731)
Expected behavior
App should not be crashing and it works same as in targetSdkVersion 33.
Put as much detail here as possible
Beta Was this translation helpful? Give feedback.
All reactions