alexmercerind / flutter_media_metadata

A Flutter plugin to read 🔖 metadata of 🎵 media files. Supports Windows, Linux, macOS, Android, iOS & Web.
MIT License
70 stars 37 forks source link

Duration on web returns null (and breaks code) #24

Open sunilguptasg opened 2 years ago

sunilguptasg commented 2 years ago

Uint8List byteString = await pickedFile.readAsBytes(); <<pickedFile is XFile Metadata videoMetaData = await MetadataRetriever.fromBytes(byteString); int? dur = videoMetaData.trackDuration; << returns null

Note: I have added this script in the section of index.html

also the code crashes on this line line 110 of flutter_media_metadata_web.dart:'albumArt': base64Decode(rawMetadataJson['Cover_Data']),

I'm basically struggling to get the duration of a picked video file on the web.

alexmercerind commented 2 years ago

Feel free to submit a fix. I never used web in any of my Flutter projects, it's just something I added to complete the set. Other than that, I wouldn't use this to get duration, but official web audio or video APIs, primary purpose of this plugin is to read tags.