ant-media / Ant-Media-Server

Ant Media Server is a live streaming engine software that provides adaptive, ultra low latency streaming by using WebRTC technology with ~0.5 seconds latency. Ant Media Server is auto-scalable and it can run on-premise or on-cloud.
https://antmedia.io
Other
4.16k stars 618 forks source link

Android 15 Beta 1 application getting crashed #6297

Open varunkumarct opened 2 months ago

varunkumarct commented 2 months ago

While running on android 15 beta 1 application is geting crashed even with scrcpy integration also its not working becuase scrcpy have chagned a lot due to andorid 15 having many changes related to display library

Google Pixel 7 and Pixel 6 OS :- Android 15 Beta 1

From the Application UI :-

  1. install the apk and from the ui Select screen Capture
  2. Video Source Screen.

From the Command Line Application :-

  1. push the application inside the device /data/local/tmp/ direcotry
  2. Run the following command
  3. adb shell CLASSPATH=/data/local/tmp/antmedia.apk LD_LIBRARY_PATH=/data/local/tmp app_process / io.antmedia.webrtc_android_sample_app.SystemCapture wss://stream-ind.pcloudy.com/WebRTCAppEE/websocket 17bd600e-78e2-41d5-8792-a6174f41459a 4:- Getting crashed

Following are the link where fix is applied(Scrcpy) https://github.com/Genymobile/scrcpy/issues/4678 https://github.com/Genymobile/scrcpy/issues/4656 https://github.com/Genymobile/scrcpy/pull/4657

It should work properly

Logs

04-12 12:49:51.305 8806 8821 E WSChannelRTCClient: sent websocket message:{"command":"publish","streamId":"17bd600e-78e2-41d5-8792-a6174f41459a","token":"tokenId","subscriberId":"","subscriberCode":"","streamName":"","video":true,"audio":true} --------- beginning of crash 04-12 12:49:51.315 8806 8834 E AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1 04-12 12:49:51.315 8806 8834 E AndroidRuntime: PID: 8806 04-12 12:49:51.315 8806 8834 E AndroidRuntime: java.lang.RuntimeException: java.lang.NoSuchMethodException: android.view.SurfaceControl.createDisplay [class java.lang.String, boolean] 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at io.antmedia.webrtcandroidframework.scrcpy.DisplayCapturerAndroid.createDisplay(DisplayCapturerAndroid.java:112) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at io.antmedia.webrtcandroidframework.scrcpy.DisplayCapturerAndroid.capture(DisplayCapturerAndroid.java:72) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at io.antmedia.webrtcandroidframework.scrcpy.DisplayCapturerAndroid.startCapture(DisplayCapturerAndroid.java:66) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at io.antmedia.webrtcandroidframework.WebRTCClient.createVideoTrack(WebRTCClient.java:2220) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at io.antmedia.webrtcandroidframework.WebRTCClient.lambda$initializeVideoCapturer$2$io-antmedia-webrtcandroidframework-WebRTCClient(WebRTCClient.java:800) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at io.antmedia.webrtcandroidframework.WebRTCClient$$ExternalSyntheticLambda29.run(Unknown Source:2) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: Caused by: java.lang.NoSuchMethodException: android.view.SurfaceControl.createDisplay [class java.lang.String, boolean] 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at java.lang.Class.getMethod(Class.java:2950) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at java.lang.Class.getMethod(Class.java:2450) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at com.genymobile.scrcpy.wrappers.SurfaceControl.createDisplay(SurfaceControl.java:81) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: at io.antmedia.webrtcandroidframework.scrcpy.DisplayCapturerAndroid.createDisplay(DisplayCapturerAndroid.java:110) 04-12 12:49:51.315 8806 8834 E AndroidRuntime: ... 8 more 04-12 12:49:51.315 1483 1686 I DropBoxManagerService: add tag=sys

varundtsfi commented 1 month ago

If we are updating the targetSdkVersion 33 to 34 then application is getting crashed due to the permission issue.

I have fixed the Android 15 Beta 1 scrcpy issue too soon i will send the PR

05-01 13:07:59.406 10082 10082 E AndroidRuntime: FATAL EXCEPTION: main 05-01 13:07:59.406 10082 10082 E AndroidRuntime: Process: io.antmedia.webrtc_android_sample_app, PID: 10082 05-01 13:07:59.406 10082 10082 E AndroidRuntime: java.lang.RuntimeException: Unable to create service io.antmedia.webrtc_android_sample_app.MediaProjectionService: java.lang.SecurityException: Starting FGS with type mediaProjection callerApp=ProcessRecord{b1e4898 10082:io.antmedia.webrtc_android_sample_app/u0a278} 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] 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:4948) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2420) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:232) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.os.Looper.loop(Looper.java:317) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8628) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: Caused by: java.lang.SecurityException: Starting FGS with type mediaProjection callerApp=ProcessRecord{b1e4898 10082:io.antmedia.webrtc_android_sample_app/u0a278} 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] 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.os.Parcel.createExceptionOrNull(Parcel.java:3215) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:3199) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:3182) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:3124) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6944) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.app.Service.startForeground(Service.java:863) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at io.antmedia.webrtc_android_sample_app.MediaProjectionService.onCreate(MediaProjectionService.java:51) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:4935) 05-01 13:07:59.406 10082 10082 E AndroidRuntime: ... 9 more