sc4v3ng3r / flutter_audio_query

Flutter Audio Query Plugin
https://pub.dev/packages/flutter_audio_query
MIT License
52 stars 47 forks source link

SongInfo shows wrong album cover #4

Open dvorapa opened 5 years ago

dvorapa commented 5 years ago

Weird enough, for all audio files I get the same album cover

sc4v3ng3r commented 5 years ago

What Android version you was running? Android Q ?

dvorapa commented 5 years ago

Android 6 (the third most used Android in the world per https://gs.statcounter.com/os-version-market-share/android/mobile-tablet/worldwide)

sc4v3ng3r commented 5 years ago

Really weird. I've the example app running well on my device with Android 6. If possible share your app code or snippet and maybe I can do some tests trying reproduce that behavior and look more closer that situation.

dvorapa commented 5 years ago

You can see it in action here: https://github.com/dvorapa/stepslow/blob/master/lib/main.dart#L1086.

For every ListTile it draws an album artwork from the SongInfo class, but for all songs within one folder, the album artwork is the same, although other parts of the SongInfo are different. Somehow I get 4 different songs (different artist, different title, different year, different duration), but all with the same (incorrect) album, albumID and albumArtwork using your package.

dvorapa commented 5 years ago

Here are few examples of what I get. The ringtones here all belong to a different albums, but all are in the same folder called "Music". This is just songInfo.toString() for each of them in my fetch() function:

I/flutter (16485): SongInfo({composer: null, artist_id: 2, album: Music, is_notification: 0, is_ringtone: 0, duration: 1933, artist: <unknown>, year: null, is_podcast: 0, album_id: 154, _size: 31691, _data: /storage/emulated/0/Music/Google_Event-1.mp3, track: 0, title: Google Event, bookmark: null, is_music: 1, album_artwork: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1571389004003, _id: 13164, is_alarm: 0, _display_name: Google_Event-1.mp3})
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): 
I/MediaPlayer(16485): setDataSource(71, 0, 576460752303423487)
I/flutter (16485): SongInfo({composer: null, artist_id: 2, album: Music, is_notification: 0, is_ringtone: 0, duration: 1447, artist: <unknown>, year: null, is_podcast: 0, album_id: 154, _size: 11577, _data: /storage/emulated/0/Music/help.mp3, track: 0, title: help, bookmark: null, is_music: 1, album_artwork: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1571389004003, _id: 13102, is_alarm: 0, _display_name: help.mp3})
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): SongInfo({composer: null, artist_id: 2, album: Music, is_notification: 0, is_ringtone: 0, duration: 4301, artist: <unknown>, year: null, is_podcast: 0, album_id: 154, _size: 86062, _data: /storage/emulated/0/Music/I M Groot_high_quality.mp3, track: 0, title: I M Groot_high_quality, bookmark: null, is_music: 1, album_artwork: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1571389004003, _id: 13103, is_alarm: 0, _display_name: I M Groot_high_quality.mp3})
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): SongInfo({composer: null, artist_id: 2, album: Music, is_notification: 0, is_ringtone: 0, duration: 3866, artist: <unknown>, year: null, is_podcast: 0, album_id: 154, _size: 62745, _data: /storage/emulated/0/Music/Up.mp3, track: 0, title: Notification Up, bookmark: null, is_music: 1, album_artwork: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1571389004003, _id: 13108, is_alarm: 0, _display_name: Up.mp3})
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): SongInfo({composer: null, artist_id: 2, album: Music, is_notification: 0, is_ringtone: 0, duration: 1724, artist: <unknown>, year: null, is_podcast: 0, album_id: 154, _size: 45132, _data: /storage/emulated/0/Music/pikachu roar_high_quality (mp3cut.net).mp3, track: 0, title: pikachu roar_high_quality (mp3cut.net), bookmark: null, is_music: 1, album_artwork: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1571389004003, _id: 13104, is_alarm: 0, _display_name: pikachu roar_high_quality (mp3cut.net).mp3})
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): SongInfo({composer: null, artist_id: 2, album: Music, is_notification: 0, is_ringtone: 0, duration: 1515, artist: <unknown>, year: null, is_podcast: 0, album_id: 154, _size: 24658, _data: /storage/emulated/0/Music/pikachuuuuuuu.mp3, track: 0, title: pikachuuuuuuu, bookmark: null, is_music: 1, album_artwork: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1571389004003, _id: 13105, is_alarm: 0, _display_name: pikachuuuuuuu.mp3})
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): SongInfo({composer: null, artist_id: 2, album: Music, is_notification: 0, is_ringtone: 0, duration: 810, artist: <unknown>, year: null, is_podcast: 0, album_id: 154, _size: 15852, _data: /storage/emulated/0/Music/Pumm pum_high_quality (mp3cut.net)(1).mp3, track: 0, title: Pumm pum_high_quality (mp3cut.net)(1), bookmark: null, is_music: 1, album_artwork: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1571389004003, _id: 13106, is_alarm: 0, _display_name: Pumm pum_high_quality (mp3cut.net)(1).mp3})
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): SongInfo({composer: null, artist_id: 2, album: Music, is_notification: 0, is_ringtone: 0, duration: 4153, artist: <unknown>, year: null, is_podcast: 0, album_id: 154, _size: 67286, _data: /storage/emulated/0/Music/SYMPHONY-028fe519-23e6-3bfa-86e7-1c5f30ba0f3d.mp3, track: 0, title: SYMPHONY, bookmark: null, is_music: 1, album_artwork: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1571389004003, _id: 13107, is_alarm: 0, _display_name: SYMPHONY-028fe519-23e6-3bfa-86e7-1c5f30ba0f3d.mp3})
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): 
I/flutter (16485): SongInfo({composer: null, artist_id: 3, album: Music, is_notification: 0, is_ringtone: 0, duration: 2220, artist: AudioTrim, year: null, is_podcast: 0, album_id: 154, _size: 36125, _data: /storage/emulated/0/Music/Water Drop.mp3, track: 0, title: Water Drop, bookmark: null, is_music: 1, album_artwork: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1571389004003, _id: 13109, is_alarm: 0, _display_name: Water Drop.mp3})
sc4v3ng3r commented 5 years ago

Hey bro... I did a test here and I was able to reproduce the same behavior.

It looks like to me a default platform behavior and let me explain you why. Well what I did was create a new directory and moved some song files from an old directory to that new one and I could see that for some reason the album and album_id properties in all moved audio files was changed and becomes respectively the new created directory name and id. Probably the process that move and/or copy the audio files is changing the audio files metadata using Android MediaStore API.

So I don't think it's a metadata query problem. I've also installed a third party mp3 player app and it gave me the same results. If you could do the same and confirm the results with a third party app please help me to confirm that hypothesis.

Thanks by your feedback.

dvorapa commented 5 years ago

You are right, so this is an Android (<7 ?) issue. I don't mind the album_id or album itself, but album_artwork copied to songs it has nothing to do with is not really convenient. Damn!

sc4v3ng3r commented 5 years ago

Well I am not sure if it's an Android <7 issue, I can test it on physical device with Android Pie this week and keep you posted. About album_artwork yeahh weird behavior! and the most funny is if you copy a song to another directory the album_artwork property will not change but album and album_id will change.

I would suggest you to provide a way to the users change the metadata of a song file in your app using this package, but I am not sure if it allows change the ALBUM_ART property.

I know that native library allows it and a complete port of that library to Flutter would be great!

dvorapa commented 5 years ago

Well, my app is aiming to be as simple as possible. User can just pick folder/songs and play, the app just allows user to slow down/speed up playback easily, because this is the main aim of my app.

I will ignore this issue as it is Android default behavior (bug or feature, who knows). The only other issue I'm stuck with is that I can not make Flutter list music folders/songs from SD card (or even to tell me where is the SD card's root directory) and the Android 6 default file/folder picker doesn't allow to pick multiple songs at once. But this perhaps has also nothing to do with your really great package.

I sometimes wonder how old version of Android to support, but then I look at people's phones at a bus stop or in a bus (over a shoulder, just out of curiosity) and I see Androids all the way back to Lollipop.

dvorapa commented 5 years ago

After the last flutter stable update, the album cover is not showing anymore for any song I've tried. It goes with an error message, I'll better share it in new issue #6.

dvorapa commented 5 years ago

Okay, this is even weirder: for some music I get different album images in my app in comparison to other apps

I guess finally this is a cache issue not caused by Android itself, even if it can be buggy too. In other music apps I see this:

Other apps

My app

dvorapa commented 5 years ago

I think this is somehow related to (id3 ?) tags, because if a song has been saved with tags from MusicBrainz' Picard, I get "No file found at the specified location" even if other apps can show the image. If the song has not been saved with tags from MusicBrainz Picard (the tags of the file are original or none), I get the same image for all of these songs (even if there is no issue in other apps or just in some apps, but not all of them). That's what I got from more extensive testing

dvorapa commented 4 years ago

I use flutter_ffmpeg currently to extract thumbnails. Pretty neat solution I must say