I am making an app with Expo to record voice messages and I am using the newer version expo-audio to help with this. I basically follow the code in the expo document but it doesn't want to work...
const startRecording = async () => {
await audioRecorder.prepareToRecordAsync();
audioRecorder.record();
setRecording(audioRecorder.isRecording);
};
const stopRecording = async () => {
await audioRecorder.stop();
setRecording(audioRecorder.isRecording);
setAudioUri(audioRecorder.uri ?? "");
};
From the code snippet above, the audioRecorder.isRecording
is false
which I expect to be true
since it should be recording... And because it's not recording, the audioRecorder.stop()
throws an exception:
[Error: Call to function 'AudioRecorder.stop' has been rejected.
→ Caused by: java.lang.IllegalStateException]
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745063286a4609099.html
评论列表(0条)