Error on MediaRecorder Stop : stop called in invalid state 4

后端 未结 1 1804
猫巷女王i
猫巷女王i 2021-01-13 10:47

I\'m creating a recording voice app, when I\'m trying to stop recording the Debug Console in java says that: \"MediaRecorder stop called in an invalid state : 4\" Here is

相关标签:
1条回答
  • 2021-01-13 11:19
    private void stopRecording() {
        if (null != recorder){
            try {
                recorder.prepare();  <-- Here's the problem
    

    You should not be calling prepare when you're stopping the MediaRecorder. The prepare method is something you call prior to starting the recorder. Refer to the state diagram in the MediaRecorder documentation.

    0 讨论(0)
提交回复
热议问题