Open s681562 opened 8 months ago
It's an error occured when reading metadata of a file without having anymetadata/tag. When No tags found, creating a new tag of type Id3v2
also caused this error of metadata_god package. Try using try-cartch-finally handeling method.
Best solution is:
try{
// Fetch metadata for each song
Metadata filemetadata = await MetadataGod.readMetadata(file: songFile.path);
}
catch (e) {
// Handle individual file metadata errors
print("Error reading metadata for ${songFile.path}: $e");
// Skip the current file and continue with the next one
continue;
}
minSdk 29 targetSdk 34 compileSdk 34
I/flutter (16667): #### writeAudioTagArtist file path /storage/emulated/0/Recordings/Call/통화 녹음 010aaaaxxxx_240308_160557.m4a I/flutter (16667): ###### writeAudioTagArtist exception Instance of 'FrbAnyhowException' I/flutter (16667): #0 FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:133) I/flutter (16667): #1 FlutterRustBridgeBase.executeNormal. (package:flutter_rust_bridge/src/basic.dart:70)
FAILED Metadata metadata = await MetadataGod.readMetadata(file: path);
What I am executed:
Future writeAudioTagArtist(String path, String phone) async {
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
AndroidDeviceInfo info = await deviceInfoPlugin.androidInfo;
int sdkVersion = info.version.sdkInt;
if (Platform.isAndroid && sdkVersion <= 32) {
final bool hasStorageAccess = await Permission.storage.isGranted;
if(!hasStorageAccess) {
await Permission.storage.request();
if (!await Permission.storage.isGranted) {
print("#### writeAudioTagArtist Permission.storage not granted");
return;
}
}
}
}
Please help. Thanks in advance.