My code is as follows:
Future<void> startPlayer(String filepath) async {
try {
// For ex, filepath is getApplicationDocumentsDirectory().path+"/file.aac"
final DeviceFileSource source = DeviceFileSource(filepath);
await _player?.play(source);
} catch (e) {
throw SoundPlayerException(e.toString());
}
}
But it still throws the PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null). It works smoothly on Android. Not sure what is the exact issue. the same code was working fine earlier. I tried Flutter_sound plugin as well. it is not able to play the audio file as well. I have also copied the code from the demo/examples and tried to play the same file as well but no luck with both plugins.
If anyone has an idea, please guide me. I am clueless.