Open BhautikVaghasiya opened 1 week ago
Future<void> downloadMusic() async {
try {
showLoader();
String fileNameExtension =
path.extension(selectedMusicRowData.value.id ?? '');
Directory appDocDir;
if (Platform.isAndroid) {
appDocDir = (await getApplicationCacheDirectory());
musicPath.value =
"${appDocDir.path}/${selectedMusicRowData.value.id}.mp3";
} else {
appDocDir = await getApplicationDocumentsDirectory();
musicPath.value =
"${appDocDir.path}${selectedMusicRowData.value.id}.mp3";
}
await Dio()
.download(selectedMusicRowData.value.url ?? '', musicPath.value);
logger("hey:::::::${musicPath.value}");
} catch (e) {
print(e);
showError(msg: "$e");
} finally {
dismissLoader();
}
}
Hi @BhautikVaghasiya
Please provide more informations. What is the result of musicPath.value
? What do you pass as assetAudioPath
?
PlatformException(NATIVE_ERR, [SwiftAlarmPlugin] Failed to load audio for asset: /Users/kaushik/Library/Developer/CoreSimulator/Devices/D591C27E-3861-458C-AC82-F3E5E8B5E518/data/Containers/Data/Application/DE27471C-3207-485E-BF5A-2546B11A2CF7/Documents/989fcf8f-7a68-4c1c-baa3-a4129214b717.mp3, null, null)