A simple Flutter plugin for reading ๐ metadata of ๐ต media files.
dependencies:
media_metadata_retriever: ^0.0.1+4
import 'package:media_metadata_retriever/media_metadata_retriever.dart';
Future<Map<String, dynamic>> getMetadata() async {
final retriever = new MediaMetadataRetriever();
/* Setting a file path. */
await metadataRetriever.setFile(new File('/storage/emulated/0/Music/music.aac'));
/* Reading its metadata. */
Metadata metadata = await retriever.metadata;
metadata.trackName;
metadata.trackArtistNames;
metadata.albumName;
metadata.albumArtistName;
metadata.trackNumber;
metadata.albumLength;
metadata.year;
metadata.genre;
metadata.authorName;
metadata.writerName;
metadata.discNumber;
metadata.mimeType;
metadata.trackDuration;
metadata.bitrate;
/* Accessing album art as Uint8List. Use [Image.memory] to show it inside the app. */
retriever.albumArt;
/* Converting metadata to a Map<String, dynamic>. */
return metadata.toMap();
}
You may checkout example app for this plugin here.
Screenshot 1 | Screenshot 2 |
---|---|
Platform | Status |
---|---|
Android | Working |
Linux | Coming Soon |
Windows | Not Working |
MediaMetadataRetriever on Android does the job. Pretty easy right?
Author: alexmercerind
Source Code: https://github.com/alexmercerind/media_metadata_retriever
#flutter #dart #mobile-apps