Expo AV audio not playing on iOS/ iPhone

I have used Expo AV and developed a screen in my app to play audio files fetched from my server URI. It works fine on Android, but doesn’t play anything on iPhone When I play a button to play the audio which loads and plays the file soundObject.loadAsync({ uri: this.state.file }); soundObject.playAsync();

it returns an error :This media format is not supported. - The AVPlayerItem instance has failed with the error code -11828 and domain “AVFoundationErrorDomain”.

Here is my code that loads and plays the audio :

async loadAudio() {
soundObject = new Audio.Sound();
try {
await soundObject.loadAsync({ uri: this.state.file });
console.log("File loaded: " + this.state.file);
} catch (error) {
console.log(error);
}
}


async playAudio() {
if (!this.state.isPlayingAudio) {
try {
  
  await soundObject.playAsync();
} catch (error) {
  console.log(error);
}

  else {
soundObject.pauseAsync();
  }
  }

I have tried changing the audio format to m4a, wav, caf while recording and fetching the file but that did not help. Any suggestions/ fixes, please? Thanks in advance

Expo CLI 3.28.2 environment info:
System:
OS: Windows 10 10.0.17763
Binaries:
Node: 12.13.0 - C:\Users\DELL\AppData\Roaming\npm\node.CMD
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.7 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 4.0.0.0 AI-193.6911.18.40.6626763
npmPackages:
expo: ~40.0.0 => 40.0.0
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2
react-native-web: ~0.13.12 => 0.13.18
Expo Workflow: managed

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.