Open Naguchennai opened 3 months ago
it's actually saving in the app dirctory ...if you need you to store that in the local music folder then you should copy that stored file from that app directory to desire folder and then delete from app directory
eg:
Future
// Request storage permissions
if (await Permission.manageExternalStorage.request().isGranted) {
String musicDirectoryPath = '/storage/emulated/0/Music';
Directory musicDirectory = Directory(musicDirectoryPath);
if (!await musicDirectory.exists()) {
await musicDirectory.create(recursive: true);
}
print('Output directory: $musicDirectoryPath');
_trimmer.saveTrimmedAudio(
startValue: _startValue,
endValue: _endValue,
audioFolderName: 'Music',
audioFileName: '${DateTime.now().millisecondsSinceEpoch}.mp3',
storageDir: StorageDir.externalStorageDirectory,
onSave: (outputPath) async {
// Copy the file to the public Music directory
File savedFile = File(outputPath!);
String newPath =
'$musicDirectoryPath/${savedFile.uri.pathSegments.last}';
await savedFile.copy(newPath);
await savedFile.delete();
setState(() {
_progressVisibility = false;
});
debugPrint('OUTPUT PATH: $newPath');
},
);
} else {
setState(() {
_progressVisibility = false;
});
_showSnackBar('Storage permission denied');
}
}
Where its saving?? its not in music folder ... its showing /data/user/0/com.test/app_flutter/Trimmer/1722939802410.mp3 but its not available mp3 list ... how can i move this file to music folder?