Android MediaRecorder - “start failed: -19”

后端 未结 5 1372
广开言路
广开言路 2020-11-27 21:42

I\'m trying to create a video recorder on Android, and I\'ve prepared my code which is supposed to be working - but I constantly get an error message start failed: -19

5条回答
  •  天涯浪人
    2020-11-27 22:46

    the problem is in your setVideoSize() code .

    and why this code error ...

    From the research I have done, error code -19 comes about when there is a problem with the size of the video as set by MediaRecorder#setVideoSize()

    run this code , and see whitch screen that your camera in your device can support :

    final List mSupportedVideoSizes = getSupportedVideoSizes(mCamera);
            for (Camera.Size str : mSupportedVideoSizes)
                Log.e(TAG, "mSupportedVideoSizes "+str.width + ":" + str.height + " ... "
                        + ((float) str.width / str.height));
    

    and method is :

    public List getSupportedVideoSizes(Camera camera) {
            if (camera.getParameters().getSupportedVideoSizes() != null) {
                return camera.getParameters().getSupportedVideoSizes();
            } else {
                // Video sizes may be null, which indicates that all the supported 
                // preview sizes are supported for video recording.
                return camera.getParameters().getSupportedPreviewSizes();
            }
        }
    

提交回复
热议问题