Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoRecorder.startRecording crashes Android with IOException "prepare failed" #1

Open
disbelief opened this issue May 29, 2020 · 0 comments

Comments

@disbelief
Copy link
Owner

When calling VideoRecorder.startRecording the Android app crashes with an IOException and message "prepare failed". The stack trace goes all the way into the MediaRecorder._prepare native method. I have attached a debugger to just before this call and can see that the MediaRecords does have a valid mPath for the file to write to.

Here are the logs when startRecording is called:

V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 106446585, pluginId: VideoRecorder, methodName: startRecording
V/Capacitor: callback: 106446585, pluginId: VideoRecorder, methodName: startRecording, methodData: {}
I/Capacitor/Console: File: http://localhost/static/js/main.27ece3d6.chunk.js - Line 1 - Msg: VideoRecorderContainer.render
I/HwSecImmHelper: mSecurityInputMethodService is null
I/PermissionManager: camera remind result:true
I/HwMediaPermWrapper: confirmCameraPermission, blocked:false
D/HwAppInnerBoostImpl: asyncReportData ca.auka.videorecorder,2,1,1,0 interval=127
I/MediaRecorder: enter in file frameworks/av/media/libmedia/mediarecorder.cpp, function prepare, line 461
I/IMediaRecorder: prepare (BpMediaRecorder client) in file frameworks/av/media/libmedia/IMediaRecorder.cpp, function prepare, line 253
E/MediaRecorder: prepare failed: -2147483648
W/System.err: java.io.IOException: prepare failed.
W/System.err:     at android.media.MediaRecorder._prepare(Native Method)
W/System.err:     at android.media.MediaRecorder.prepare(MediaRecorder.java:1038)
W/System.err:     at co.fitcom.fancycamera.Camera2.setUpMediaRecorder(Camera2.java:607)
W/System.err:     at co.fitcom.fancycamera.Camera2.startRecording(Camera2.java:837)
W/System.err:     at co.fitcom.fancycamera.FancyCamera.startRecording(FancyCamera.java:323)
W/System.err:     at com.github.sbannigan.capacitor.VideoRecorder.startRecording(VideoRecorder.java:267)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99)
W/System.err:     at com.getcapacitor.Bridge$1.run(Bridge.java:515)
W/System.err:     at android.os.Handler.handleCallback(Handler.java:907)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:105)
W/System.err:     at android.os.Looper.loop(Looper.java:216)
W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:65)
V/Capacitor/VideoRecorder: Notifying listeners for event onVolumeInput
D/Capacitor/VideoRecorder: No listeners found for event onVolumeInput
V/Capacitor/VideoRecorder: Notifying listeners for event onVolumeInput
D/Capacitor/VideoRecorder: No listeners found for event onVolumeInput
I/CameraDevice-JV-1: Camera now idle

I can see that the output video file does get created on the device, but it remains empty (size 0 B). So I think this indicates that IO to the file is not the problem. The file is being stored in the private data directory of the app, any of the shared system directories (eg. "Photos" or "Movies").

As can be seen in the manifest both CAMERA and RECORD_AUDIO permissions are specified, and I can confirm that the app requests the correct permissions from the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant