I'm using flutter audio player package https://pub.dev/packages/audioplayers to play audio file from the Device File Path. The problem is I cannot Play Audio File in IOS. But it's working fine in Android. Please Help me how to play audio File from Device File Path in IOS.
I already try to change the file extension to mp3,aac,acc,m4a,wav. But it still doesn't play in IOS.
I was solved by adding "temp.mp3" at the end of the dir path.
var file = File(path);
Uint8List bytes = file.readAsBytesSync();
var buffer = bytes.buffer;
var unit8 = buffer.asUint8List(32, bytes.lengthInBytes - 32);
Directory dir = await getApplicationDocumentsDirectory();
var tmpFile = "${dir.path}/tmp.mp3";
var writeFile = File(tmpFile).writeAsBytesSync(unit8);
var urlSource = DeviceFileSource(tmpFile);
audioPlayer.play(urlSource);