How to get audio metadata from its path in flutter?

3.8k Views Asked by At

I have path of the audio file like "sdcard://music/ABC.mp3" . How to get other details such as album, artist, duration etc from that path.

2

There are 2 best solutions below

3
On

If you are using flutter_sound, there are utility methods which can give you the duration in milliseconds and some other metadata. From the package docs:

int duration = await flutterSoundHelper.duration( this._path[_codec.index] );
Map<dynamic, dynamic> info = await flutterSoundHelper.FFmpegGetMediaInformation( uri );
1
On

You can use fluter_music_player plugin to play, pause, album artist, duration etc. It's support both ios and android.

See Flutter Music Player this sample Music player flutter project using this plugin