6

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

Logcat 不显示任何错误消息。但是,在 Samsung 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
            }
        }
    }
};
4

1 回答 1

0

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

于 2016-06-19T11:40:57.093 回答