I'm trying to retrive some info like duration,width and height from videos i pick from the phone gallery. I'm using :
flutter_ffmpeg: ^0.4.2
this is the code i use :
Future<Map?> getVideoInfo(String VideoPath) async {
bool errorResult = false;
FlutterFFprobe fFprobe = FlutterFFprobe();
String? duration = "0";
String? width = "0";
String? height = "0";
await fFprobe.getMediaInformation(VideoPath).then((info) {
duration = info.getAllProperties()['duration'].toString();
width = info.getAllProperties()['width'].toString();
height = info.getAllProperties()['height'].toString();
}, onError: (value) {
errorResult = true;
}).catchError((error) {
errorResult = true;
});
if (errorResult == true) {
Map resultmap = {"width": "0", "height": "0", "duration": "0"};
return resultmap;
}
Map resultmap = {"width": width, "height": height, "duration": duration};
return resultmap;
}
According to documentation https://pub.dev/packages/flutter_ffmpeg i'm trying to retrive elements in that way:
info.getAllProperties()['width'].toString();
but i can retrive only duration, width and eight are always null. Values are in the getAllProperties dictionary because i can see "width=1920 and height=824" using the Vscode debugger.
There is only a difference beetween those voices and "duration" , they are grayed out by the Vscode debugger insted of duration that is "red".
Anyway, why i can't access width and eight even if they seems to be accessible?