最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

expo-audio doesn't record the voice message - Stack Overflow

programmeradmin0浏览0评论

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]
发布评论

评论列表(0)

  1. 暂无评论