Using Expo AV's Audio, I can play a sound from a remote server just fine. However, when I download the same file on the Simulator's local storage, I'm unable to play the sound anymore.
Here's the part of the code where I load the sound:
const path = `${RNFS.DocumentDirectoryPath}/AudioDownload/${programmeID}/${cdNumber}/${track.filename}`;
// If file exists on FS -> assign its path to uri. Otherwise -> assign the https path instead.
let uri = (await RNFS.exists(path)) ? path : track.url;
// Create sound obj
let sound = new Audio.Sound();
await sound.loadAsync(
{ uri },
{ shouldPlay: true }
);
// Return
return sound;
The error occurs on the loadAsync
functionality. It prints the following error message to the terminal:
Possible Unhandled Promise Rejection (id: 0):
Error: Cannot complete operation because sound is not loaded.
I saw someone raised a similar issue here: Expo AV React Native Local Sound File issue, but I it didn't resolve mine.