I'm trying to build a simple audio player that loads a file from our server and plays it. Currently this code works on Android but iOS doesn't work, throwing the error
AVPlayerItem instance has failed with the error code -11850 and domain "AVFoundationErrorDomain"
From what I've gathered, this is an issue with iOS expecting a file extension when it tries to load the audio file. We are using the exact same server route on our React web app with no problems, it's able to load the file within a simple audio html element. Android is also functioning with the React Native code below:
const loadNewPlaybackInstance = async playing => {
const source = { uri: url } // defined as `${api}/api/v1/voicemail?s3_email_id=${s3_email_id}`
// This returns a voicemail.wav file
const initialStatus = {
shouldPlay: playing,
rate: 1.0,
volume: volume,
isMuted: false,
}
try {
const { sound } = await Audio.Sound.createAsync(
source,
initialStatus,
onPlaybackStatusUpdate,
)
setPlaybackInstance(sound)
updateScreenForLoading(false)
} catch (error) {
console.error(error.message)
}
}
I've found another SO question, but there isn't a real answer.
There is also an open issue on Github which seems to be forgotten that I've also tried to revive.
Does anyone have any insight into how to resolve this issue? Let me know if there is more detail/context needed to help.