alexmercerind / flutter_media_metadata

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

Meta data scrambled when requesting meta data from a sequence of files asynchronously #4

Closed ton-An closed 3 years ago

ton-An commented 3 years ago

When requesting meta data for a list of files the meta data gets mixed up. The MetaDataRetriever quite often returns the same meta data twice or thrice or scrambles together a completly new set of meta data.

A quick but dirty fix is delaying each meta data request by a 100ms.

alexmercerind commented 3 years ago

Hi there @ton-An !

Are you retrieving metadata asynchronously (I mean two or more files at the same time)?

I'm using this plugin in my app, here & it works well. I'm asking for the metadata one at a time.

Although, I accept my fault, that it should be fixed.

Thanks for the report!

ton-An commented 3 years ago

Ahh, that solved it.

I was scanning the storage with the stream from directory.list and then immedeatly requesting meta data for the files. Making that operation synchronous worked

alionour commented 3 years ago

Any updates about this or a workaround

alexmercerind commented 3 years ago

This was actually a design problem, refactored code & changed API a bit. Fixed, calls are now multithread friendly.