Skip to content

startRecording throws IOException in MediaRecorder prepare call #9

Description

@disbelief

This is on a Samsung device running Android 7.1.1

For background, fancycamera is a dependency of the capacitor-video-recorder plugin. I've updated the plugin to use the latest version of fancycamera from maven (v1.2.2).

Calling startRecording throws an uncaught IOException which locks up my app. Here is the log output:

2020-04-06 15:27:32.745 D/InputMethodManager: HSIFW - flag : 0 Pid : 10941
2020-04-06 15:27:33.546 I/art: Background sticky concurrent mark sweep GC freed 345032(9MB) AllocSpace objects, 7(140KB) LOS objects, 68% free, 4MB/14MB, paused 1.493ms total 131.661ms
2020-04-06 15:27:35.760 V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 90928156, pluginId: VideoRecorder, methodName: startRecording
2020-04-06 15:27:35.760 V/Capacitor: callback: 90928156, pluginId: VideoRecorder, methodName: startRecording, methodData: {}
2020-04-06 15:27:35.761 I/RequestQueue: Repeating capture request cancelled.
2020-04-06 15:27:35.761 I/MediaRecorderJNI: native_reset
2020-04-06 15:27:35.761 I/MediaRecorderJNI: release
2020-04-06 15:27:35.764 I/MediaRecorderJNI: setup
2020-04-06 15:27:35.765 I/MediaRecorderJNI: setAudioSource(1)
2020-04-06 15:27:35.772 I/MediaRecorderJNI: setVideoSource(2)
2020-04-06 15:27:35.794 I/MediaRecorderJNI: setVideoSize(640, 480)
2020-04-06 15:27:35.794 I/MediaRecorderJNI: setParameter()
2020-04-06 15:27:35.795 I/MediaRecorderJNI: setParameter()
2020-04-06 15:27:35.796 I/MediaRecorderJNI: setVideoFrameRate(30)
2020-04-06 15:27:35.796 I/MediaRecorderJNI: setParameter()
2020-04-06 15:27:35.797 I/CameraDeviceState: Legacy camera service transitioning to state IDLE
2020-04-06 15:27:35.797 I/MediaRecorderJNI: setParameter()
2020-04-06 15:27:35.798 I/MediaRecorderJNI: setVideoEncoder(5)
2020-04-06 15:27:35.798 I/MediaRecorderJNI: setAudioEncoder(3)
2020-04-06 15:27:35.802 I/CameraDeviceState: Legacy camera service transitioning to state CONFIGURING
2020-04-06 15:27:35.804 I/RequestThread-1: Configure outputs: 0 surfaces configured.
2020-04-06 15:27:35.810 I/MediaRecorderJNI: setOutputFile
2020-04-06 15:27:35.811 I/MediaRecorderJNI: prepare
2020-04-06 15:27:35.815 E/MediaRecorder: prepare failed: -2147483648
2020-04-06 15:27:35.816 W/System.err: java.io.IOException: prepare failed.
2020-04-06 15:27:35.816 W/System.err:     at android.media.MediaRecorder._prepare(Native Method)
2020-04-06 15:27:35.817 W/System.err:     at android.media.MediaRecorder.prepare(MediaRecorder.java:1164)
2020-04-06 15:27:35.817 W/System.err:     at co.fitcom.fancycamera.Camera2.setUpMediaRecorder(Camera2.java:607)
2020-04-06 15:27:35.817 W/System.err:     at co.fitcom.fancycamera.Camera2.startRecording(Camera2.java:837)
2020-04-06 15:27:35.817 W/System.err:     at co.fitcom.fancycamera.FancyCamera.startRecording(FancyCamera.java:323)
2020-04-06 15:27:35.817 W/System.err:     at com.github.sbannigan.capacitor.VideoRecorder.startRecording(VideoRecorder.java:274)
2020-04-06 15:27:35.817 W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2020-04-06 15:27:35.817 W/System.err:     at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99)
2020-04-06 15:27:35.817 W/System.err:     at com.getcapacitor.Bridge$1.run(Bridge.java:520)
2020-04-06 15:27:35.817 W/System.err:     at android.os.Handler.handleCallback(Handler.java:751)
2020-04-06 15:27:35.817 W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
2020-04-06 15:27:35.818 W/System.err:     at android.os.Looper.loop(Looper.java:154)
2020-04-06 15:27:35.818 W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:61)
2020-04-06 15:27:35.909 D/Camera: app passed NULL surface
2020-04-06 15:27:35.928 W/SurfaceTextureRenderer: No output surfaces configured for GL drawing.
2020-04-06 15:27:35.943 I/CameraDeviceState: Legacy camera service transitioning to state IDLE

Previous to calling startRecording my app displays the video preview correctly, so access to the camera and audio are not an issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions