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

react native - expo-av Recording file doesn't exist after stopAndUnloadAsync() - how? - Stack Overflow

programmeradmin4浏览0评论

We use the Recording object in the expo-av library to record long recordings. Our code to finish a recording looks like this:

await recordingRef.current.stopAndUnloadAsync();

await Audio.setAudioModeAsync({
  allowsRecordingIOS: false,
  playsInSilentModeIOS: false,
  staysActiveInBackground: false,
});

const uri = recordingRef.current.getURI();
if (!uri) {
  throw new Error("Recording stopped but failed to generate URI");
}

const fileInfo = await FileSystem.getInfoAsync(uri);
if (!fileInfo.exists) {
  throw new Error(`Recording file not found at ${uri}`);
}

...

A small handful of our users sometimes experience the error Recording file not found at ${uri}

What could cause this? How is it that stopAndUnloadAsync() can succeed awaited, getURI() can successfully return a URI but then the resulting file doesn't exist?

发布评论

评论列表(0)

  1. 暂无评论