Cap-go / capacitor-screen-recorder

Record the screen of the phone with native API
https://capgo.app
7 stars 7 forks source link

App Crashes #3

Open RAIERIN opened 2 years ago

RAIERIN commented 2 years ago

The app is crashing in some phone when ScreenRecorder.start() is called for new version of android. And the error log shows this.

D/scrcast: createRecorder() E/SensorManager: registerListenerImpl sensorName:BMI160_ACCELEROMETER Accelerometer Non-wakeup,isWakeUpSensor:false,callingApp: io.ionic.starter,callingPid:9852,callingUid:10945 E/MediaRecorder: prepare failed: -2147483648 E/AndroidRuntime: FATAL EXCEPTION: main Process: io.ionic.starter, PID: 9852 java.io.IOException: prepare failed. at android.media.MediaRecorder._prepare(Native Method) at android.media.MediaRecorder.prepare(MediaRecorder.java:1178) at dev.bmcreations.scrcast.internal.recorder.service.RecorderService.createRecorder(RecorderService.kt:159) at dev.bmcreations.scrcast.internal.recorder.service.RecorderService.access$createRecorder(RecorderService.kt:32) at dev.bmcreations.scrcast.internal.recorder.service.RecorderService$recordInternal$1.invokeSuspend(RecorderService.kt:227) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:233) at android.app.ActivityThread.main(ActivityThread.java:8068) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)

Android version: Screenshot_20220811-140609_Settings

riderx commented 2 years ago

Thanks for the report, i will check soon it's maybe link to the lib i use : https://github.com/bmcreations/scrcast/issues/58

RAIERIN commented 2 years ago

Is there any way i can fix the issue?

riderx commented 2 years ago

@RAIERIN for now i don't see a way, the issue is in scrcast. maybe i could find other plugin with better support

riderx commented 2 years ago

maybe i could try to migrate to https://github.com/HBiSoft/HBRecorder

RAIERIN commented 2 years ago

@riderx if you could migrate when will you do that.

riderx commented 2 years ago

i will check it next week

RAIERIN commented 2 years ago

Okay! Thanks

kolyneh commented 2 years ago

For this error: E/MediaRecorder: prepare failed: -2147483648 It's BAD_TYPE in native error codes. Maybe it's because of the outputFormat/videoEncoder/videoFrameRate/videoSize params. Mostly it's the resolution you set, use a resolution less than 1080P to check if it's working.

riderx commented 2 years ago

@kolyneh there no option to set the resolution in scrcast where i we could change it ?

kolyneh commented 2 years ago

Hi, check this in scrcast:

https://github.com/bmcreations/scrcast/blob/9cc8deea768dedf746c41e35c153db83aeb68b74/library/src/main/java/dev/bmcreations/scrcast/config/Options.kt#L73-L89

It's part of Options. In DSL like:

options{
    video{
         width = 1920
         heigh = 1080
    }
}