MediaRecorder.stop()挂在三星Galaxy相机上

时间:2013-02-18 19:58:18

标签: android hang mediarecorder

在我的MediaRecorder上调用stop()无限期挂起三星Galaxy相机。将此调用放在单独的线程中也无济于事。

Logcat不会显示任何错误消息。但是,运行这个相同的应用程序不会在三星Galaxy Nexus上出现任何问题。

这是我调用stop的代码:

View.OnClickListener captureListener = new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        if (isRecording) {
            // stop recording and release camera
            mMediaRecorder.stop();
            releaseMediaRecorder(); // release the MediaRecorder object
            mCamera.lock();         // take camera access back from MediaRecorder
            // inform the user that recording has stopped
            captureButton.setText("Capture");
            isRecording = false;
        } else {
            // initialize video camera
            if (prepareVideoRecorder()) {
                // Camera is available and unlocked, MediaRecorder is prepared,
                // now you can start recording
                mMediaRecorder.start();
                // inform the user that recording has started
                captureButton.setText("Stop");
                isRecording = true;
            } else {
                // prepare didn't work, release the camera
                releaseMediaRecorder();
                // inform user
            }
        }
    }
};

1 个答案:

答案 0 :(得分:0)

我看到的一件事是,对于某些设备,如果没有附加预览,MediaRecorder.stop()会挂起(即您之前调用了Camera.stopPreview(),或者您从未调用过startPreview())。