HBRecorder: Crash onClick of Start recording
Hi @HBiSoft ,
I executed the HBRecorder Example, on click of start button, the app crashes (irrespective of customSettings on/off).
- Device : Moto G7 Power
- Operation System : Android 9 (Pie)
- All permissions are given
So in logs I can see 2 exceptions:
- FileNotFoundException
- IllegalStateException : failed to get the surface
Following are the logs:
2020-02-20 14:54:59.622 17493-17493/com.hbisoft.hbrecorderexample E/MediaRecorder: SurfaceMediaSource could not be initialized!
2020-02-20 14:54:59.623 17493-17493/com.hbisoft.hbrecorderexample E/MediaRecorder: start called in an invalid state: 4
2020-02-20 14:54:59.626 17493-17493/com.hbisoft.hbrecorderexample E/HBRecorderOnError: java.io.FileNotFoundException: /storage/emulated/0/Movies/HBRecorder/HD2020-02-20-14-54-59.mp4: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:485)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:288)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:151)
at android.media.MediaRecorder.prepare(MediaRecorder.java:959)
at com.hbisoft.hbrecorder.ScreenRecordService.initRecorder(ScreenRecordService.java:385)
at com.hbisoft.hbrecorder.ScreenRecordService.onStartCommand(ScreenRecordService.java:166)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3884)
at android.app.ActivityThread.access$1700(ActivityThread.java:213)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1847)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:210)
at libcore.io.IoBridge.open(IoBridge.java:471)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:288)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:151)
at android.media.MediaRecorder.prepare(MediaRecorder.java:959)
at com.hbisoft.hbrecorder.ScreenRecordService.initRecorder(ScreenRecordService.java:385)
at com.hbisoft.hbrecorder.ScreenRecordService.onStartCommand(ScreenRecordService.java:166)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3884)
at android.app.ActivityThread.access$1700(ActivityThread.java:213)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1847)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
2020-02-20 14:54:59.628 17493-17493/com.hbisoft.hbrecorderexample E/HBRecorderOnError: java.lang.IllegalStateException: failed to get surface
at android.media.MediaRecorder.getSurface(Native Method)
at com.hbisoft.hbrecorder.ScreenRecordService.initVirtualDisplay(ScreenRecordService.java:392)
at com.hbisoft.hbrecorder.ScreenRecordService.onStartCommand(ScreenRecordService.java:186)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3884)
at android.app.ActivityThread.access$1700(ActivityThread.java:213)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1847)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
2020-02-20 14:54:59.629 17493-17493/com.hbisoft.hbrecorderexample E/HBRecorderOnError: java.lang.IllegalStateException
at android.media.MediaRecorder.start(Native Method)
at com.hbisoft.hbrecorder.ScreenRecordService.onStartCommand(ScreenRecordService.java:206)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3884)
at android.app.ActivityThread.access$1700(ActivityThread.java:213)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1847)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 22 (12 by maintainers)
Commits related to this issue
- Fix issue #6 — committed to HBiSoft/HBRecorder by HBiSoft 4 years ago
- Fix issue #6 — committed to HBiSoft/HBRecorder by HBiSoft 4 years ago
@HBiSoft This is the device width x height = 720 x 1371 recorder.setVideoSize(width, height); It throws the illegalStateExceptionError : unable to get surface
However, when we set a valid resolution like 480 * 854, 720 * 1280 etc as recorder.videoSize and set it while creating virtualDisplay, it is working fine!!!