A Flutter plugin to read πŸ”– metadata of 🎡 media files. Supports Windows, Linux & Android.

Overview

flutter_media_metadata

A Flutter plugin to read metadata of media files.

A part of Harmonoid open source project πŸ’œ


Install

Add in your pubspec.yaml.

dependencies:
  ...
  flutter_media_metadata: ^0.1.1

Issues are maintained here.

Support

Consider supporting the project by starring the repository or buying me a coffee.

Example

var metadata = await MetadataRetriever.fromFile(File('C:/Users/Alex/Music/SampleMusic.OGG'))

String? trackName = metadata.trackName;
List<String>? trackArtistNames = metadata.trackArtistNames;
String? albumName = metadata.albumName;
String? albumArtistName = metadata.albumArtistName;
int? trackNumber = metadata.trackNumber;
int? albumLength = metadata.albumLength;
int? year = metadata.year;
String? genre = metadata.genre;
String? authorName = metadata.authorName;
String? writerName = metadata.writerName;
int? discNumber = metadata.discNumber;
String? mimeType = metadata.mimeType;
int? trackDuration = metadata.trackDuration;
int? bitrate = metadata.bitrate;
Uint8List? albumArt = metadata.albumArt;

Platforms

Platform Status
Android Working
Linux Working
Windows Working

License

This library & work under this repository is MIT licensed.

Copyright (C) 2021 Hitesh Kumar Saini [email protected]

Comments
  • Provide pure Dart support in case of a platform is not supported

    Provide pure Dart support in case of a platform is not supported

    Imagine we try to run this project in the web, iOS or macOS. Likely, a Not Supported error will be thrown.

    With a pure dart implementation of this, we could make this work for every platform. I am not saying to remove the native implementation, since they're faster than Dart, I'm saying to support all the platforms, regardless of how fast it is.

    This could be done through ffi and add a pure dart implementation for the web, or just don't provide web support (I don't see how web apps would be manipulating media files, and if they do, that'd be uneffectively).

    great project btw :)

    question 
    opened by bdlukaa 4
  • Meta data scrambled when requesting meta data from a sequence of files asynchronously

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

    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.

    bug 
    opened by ton-An 4
  • Error in setDataSource

    Error in setDataSource

    When I use the following code, the continuation of the code stops without any error await MetadataRetriever.fromFile(File(songInfo.filePath));

    I tried to find the library problem to fix it image I noticed that an error occurs when using setFilePath (retriever.setFilePath(filePath);) image This function gives java.lang.IllegalArgumentException error without any message

    question 
    opened by MrMontazer 3
  • Add iOS support

    Add iOS support

    I don't own a mac or an iOS device.

    There are some people out there, who wanna use this plugin on iOS devices.

    Any Objective-C or Swift geek is free to add iOS support to this plugin.

    Thanks. My appreciation, if you decide to help out.

    enhancement help wanted 
    opened by alexmercerind 3
  • Use CompletableFuture from package for lower API level support

    Use CompletableFuture from package for lower API level support

    According to CompletableFuture CompletableFuture is Added in [API level 24]

    If app imported this package build with minSdkVersion less than [API level 24], app would run into this error

    Fatal Exception: java.lang.NoClassDefFoundError
    Failed resolution of: Ljava/util/concurrent/CompletableFuture;
    
    Caused by java.lang.ClassNotFoundException
    Didn't find class "java.util.concurrent.CompletableFuture" 
    

    So this PR is needed to support lower API level, which referred from the flutter official plugin https://github.com/flutter/plugins/commit/0bd38d2a2cf367e2418334bd32d362c1880704be

    opened by zhileichen 2
  • Compilation fails on Linux

    Compilation fails on Linux

    When attempting to run a flutter app that uses flutter_media_metadata on Linux, the compilation of the application fails.

    flutter run -d linux
    Launching lib/main.dart on Linux in debug mode...
    [/home/abitofevrything/Programming/music_player/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/cxx/utils.hpp:108:12](): warning: variable 'last_index' set but not used [-Wunused-but-set-variable]
    [/home/abitofevrything/Programming/music_player/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/cxx/metadata_retriever.cpp:56:16](): warning: variable 'size' set but not used [-Wunused-but-set-variable]
    [/home/abitofevrything/Programming/music_player/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/cxx/metadata_retriever.cpp:57:16](): warning: variable 'header' set but not used [-Wunused-but-set-variable]
    clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
    Exception: Build process failed
    
    flutter doctor -v
    [βœ“] Flutter (Channel stable, 2.10.2, on Artix Linux 5.16.10-artix1-1, locale en_GB.UTF-8)
        β€’ Flutter version 2.10.2 at /opt/flutter
        β€’ Upstream repository https://github.com/flutter/flutter.git
        β€’ Framework revision 097d3313d8 (12 days ago), 2022-02-18 19:33:08 -0600
        β€’ Engine revision a83ed0e5e3
        β€’ Dart version 2.16.1
        β€’ DevTools version 2.9.2
    
    [βœ—] Android toolchain - develop for Android devices
        βœ— ANDROID_HOME = /opt/android-sdk
          but Android SDK not found at this location.
    
    [βœ“] Chrome - develop for the web
        β€’ CHROME_EXECUTABLE = chromium
    
    [βœ“] Linux toolchain - develop for Linux desktop
        β€’ clang version 13.0.1
        β€’ cmake version 3.22.2
        β€’ ninja version 1.10.2
        β€’ pkg-config version 1.8.0
    
    [!] Android Studio (not installed)
        β€’ Android Studio not found; download from https://developer.android.com/studio/index.html
          (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
    
    [βœ“] Connected device (2 available)
        β€’ Linux (desktop) β€’ linux  β€’ linux-x64      β€’ Artix Linux 5.16.10-artix1-1
        β€’ Chrome (web)    β€’ chrome β€’ web-javascript β€’ Chromium 98.0.4758.102 Arch Linux
    
    [βœ“] HTTP Host Availability
        β€’ All required HTTP hosts are available
    
    ! Doctor found issues in 2 categories.
    
    opened by abitofevrything 1
  • Fatal Exception: java.lang.NoClassDefFoundError Failed resolution of: Ljava/util/concurrent/CompletableFuture;

    Fatal Exception: java.lang.NoClassDefFoundError Failed resolution of: Ljava/util/concurrent/CompletableFuture;

    Fatal Exception: java.lang.NoClassDefFoundError Failed resolution of: Ljava/util/concurrent/CompletableFuture;

    java.lang.ClassLoader.loadClass (ClassLoader.java:469) com.alexmercerind.flutter_media_metadata.a.onMethodCall (FlutterMediaMetadataPlugin.java:2) io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage (MethodChannel.java:2) io.flutter.embedding.engine.dart.DartMessenger.invokeHandler (DartMessenger.java:2) io.flutter.embedding.engine.dart.DartMessenger.a (DartMessenger.java:2) io.flutter.embedding.engine.dart.DartMessenger.b (DartMessenger.java) io.flutter.embedding.engine.dart.c.run (lambda) android.os.Handler.handleCallback (Handler.java:739)

    Not support CompletableFuture while android's minSdk is less than 24

    It is similar to an flutter/plugin issue.

    The solution can be refer to https://github.com/flutter/plugins/pull/2770/commits/0bd38d2a2cf367e2418334bd32d362c1880704be

    opened by jinchengwu-ola 1
  • No such method defined

    No such method defined

    Hello, I am having a problem that this package gives an error no such method (MetadataRetriever) defined in channel when I put the path of an audio file of my phone which is connected to my dekstop through USB.

    question 
    opened by AssassinAguilar 1
  • Linux build failed

    Linux build failed

    Hello! Your library works on Android very well & it's amazing. But, if I build for Linux, I get this strange error.

    [        ] /home/mytja/Documents/harmonoid/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/linux/include/flutter_media_metadata/flutter_types.hpp:22:10: error: explicit specialization of
    'returnValue' in class scope
    [   +1 ms]     void returnValue<int>(int result) {
    [        ]          ^
    [        ] /home/mytja/Documents/harmonoid/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/linux/include/flutter_media_metadata/flutter_types.hpp:33:10: error: explicit specialization of
    'returnValue' in class scope
    [   +1 ms]     void returnValue<std::string>(std::string result) {
    [        ]          ^
    [        ] /home/mytja/Documents/harmonoid/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/linux/include/flutter_media_metadata/flutter_types.hpp:45:10: error: explicit specialization of
    'returnValue' in class scope
    [        ]     void returnValue<std::map<std::string, std::string>>(std::map<std::string, std::string> result) {
    [        ]          ^
    [        ] /home/mytja/Documents/harmonoid/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/linux/include/flutter_media_metadata/flutter_types.hpp:79:9: error: explicit specialization of
    'getArgument' in class scope
    [        ]     int getArgument<int>(const char* argument) {
    [        ]         ^
    [        ] /home/mytja/Documents/harmonoid/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/linux/include/flutter_media_metadata/flutter_types.hpp:89:17: error: explicit specialization of
    'getArgument' in class scope
    [        ]     std::string getArgument<std::string>(const char* argument) {
    [        ]                 ^
    [        ] /home/mytja/Documents/harmonoid/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/linux/include/flutter_media_metadata/flutter_types.hpp:101:11: error: explicit specialization of
    'getArgument' in class scope
    [        ]     float getArgument<float>(const char* argument) {
    [        ]           ^
    

    Do you know what could be wrong??? Thank you so much

    opened by mytja 1
  • Null check operator used on a null value

    Null check operator used on a null value

    this line throw such error await retriever.setFile(File(song.path));

    [ERROR:flutter/runtime/dart_isolate.cc(1137)] Unhandled exception:
    Null check operator used on a null value
    #0      MethodChannel.binaryMessenger
    package:flutter/…/services/platform_channel.dart:142
    #1      MethodChannel._invokeMethod
    package:flutter/…/services/platform_channel.dart:148
    #2      MethodChannel.invokeMethod
    package:flutter/…/services/platform_channel.dart:331
    #3      MetadataRetriever.setFile
    package:flutter_media_metadata/flutter_media_metadata.dart:85
    <asynchronous suspension>
    #4      GenerateThumbnails.isolatedThread
    package:ruminate/…/utils/generate_thumbnails.dart:38
    <asynchronous suspension>
    

    dart version sdk: '>=2.13.0 <3.0.0'

    opened by 4-alok 1
  • retriever is racy

    retriever is racy

    That is when you have a listview where for each item you are trying to fetch album art, if queries are done simulatniously, multiple items will eventaually receive same data.

    I created a repro for this, see #10

    opened by nt4f04uNd 1
  • Not work in isolate

    Not work in isolate

    when using in isolate this error happen try adding WidgetsFlutterBinding.ensureInitialized() in main method but not fix.

    Binding has not yet been initialized. The "instance" getter on the ServicesBinding binding mixin is only available once that binding has been initialized. Typically, this is done by calling "WidgetsFlutterBinding.ensureInitialized()" or "runApp()" (the latter calls the former). Typically this call is done in the "void main()" method. The "ensureInitialized" method is idempotent; calling it multiple times is not harmful. After calling that method, the "instance" getter will return the binding. In a test, one can call "TestWidgetsFlutterBinding.ensureInitialized()" as the first line in the test's "main()" method to initialize the binding.

    opened by H3mnz 2
  • Error on Flutter web for media files without album art

    Error on Flutter web for media files without album art

    Hi,

    Following piece of code:

    FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true);
      if (result != null) {
      for(int x = 0; x < result.files.length; x++) {
        print(result.files[x].name);
        Uint8List bytes = result.files[x].bytes as Uint8List;
        final metadata = await MetadataRetriever.fromBytes(bytes); // throws the error
        String? trackName = metadata.trackName;
        print(trackName);
    

    [...]

    I checked this with mp3, m4a and wmv files. It only occurs on Flutter web. If the audio files contain an album art everything works fine. If they do not contain an album art, I get the following error message:

    Error: Expected a value of type 'String', but got one of type 'Null' at Object.throw_ [as throw] (http://localhost:50323/dart_sdk.js:5067:11) at Object.castError (http://localhost:50323/dart_sdk.js:5026:15) at Object.cast [as as] (http://localhost:50323/dart_sdk.js:5351:17) at Function.as (http://localhost:50323/dart_sdk.js:46170:19) at http://localhost:50323/packages/flutter_media_metadata/src/flutter_media_metadata_web.dart.lib.js:89:159 at Object._checkAndCall (http://localhost:50323/dart_sdk.js:5274:16) at Object.dcall (http://localhost:50323/dart_sdk.js:5279:17) at ret (http://localhost:50323/dart_sdk.js:62346:21)

    Afaik this relates to the following line of code:

    let metadata = new (T.IdentityMapOfString$dynamic()).from(["metadata", new _js_helper.LinkedMap.new(), "albumArt", convert.base64Decode(core.String.as(dart.dsend(rawMetadataJson, '_get', ["Cover_Data"]))), "filePath", null]);

    I cannot read nor write .js :) but it looks like a null check is missing?

    What else do you need?

    Thanks, Michael

    opened by 50n13x 2
  • Build process failed on Linux

    Build process failed on Linux

    Cannot build my project on Linux.

    flutter run -d linux:

    /home/pizi/Documents/Project/boombox/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/cxx/utils.hpp:108:12: error: variable 'last_index' set but not used [-Werror,-Wunused-but-set-variable]
    /home/pizi/Documents/Project/boombox/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/cxx/metadata_retriever.cpp:56:16: error: variable 'size' set but not used [-Werror,-Wunused-but-set-variable]
    /home/pizi/Documents/Project/boombox/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/cxx/metadata_retriever.cpp:57:16: error: variable 'header' set but not used [-Werror,-Wunused-but-set-variable]
    Exception: Build process failed
    

    flutter doctor:

    [βœ“] Flutter (Channel stable, 2.10.4, on Manjaro Linux 5.15.28-1-MANJARO, locale
        en_US.UTF-8)
    [βœ“] Android toolchain - develop for Android devices (Android SDK version
        32.1.0-rc1)
    [βœ“] Chrome - develop for the web
    [βœ“] Linux toolchain - develop for Linux desktop
    [βœ“] Android Studio (version 2021.1)
    [βœ“] Connected device (2 available)
    [βœ“] HTTP Host Availability
    

    tried as per #23, still not working

    mediainfo --version

    MediaInfo Command line, 
    MediaInfoLib - v22.03
    
    opened by MaddPenguin 8
  • Duration on web returns null (and breaks code)

    Duration on web returns null (and breaks code)

    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.

    opened by sunilguptasg 1
Releases(v1.0.0)
  • v1.0.0(Jan 30, 2022)

    • Now supporting all platforms Windows, Linux, macOS, Android, iOS & Web. πŸŽ‰πŸŽ‰πŸŽ‰
    • Add web support (@alexmercerind).
    • Add iOS support (@DiscombobulatedDrag).
    • Revert to using CompletableFuture on Android (@alexmercerind).
    Source code(tar.gz)
    Source code(zip)
  • v0.1.2(Dec 4, 2021)

    This new release of flutter_media_metadata adds & fixes:

    • Add iOS support (@DiscombobulatedDrag)
    • Linux: Use wcstombs for std::wstring conversion (@alexmercerind).
    • Linux: Fix segmentation fault with no album art files (@alexmercerind).
    • Windows: Fix media having no tags & embedded album art container causing crash (@alexmercerind).
    • Windows: Fix UTF16 tags not being parsed properly (@alexmercerind).
    • Windows: Add file_path to metadata (@alexmercerind).
    • Windows & Linux: Fix FLAC album arts (@alexmercerind).
    • Windows & Linux: Use Format Stream_General for METADATA_BLOCK_PICTURE detection (@alexmercerind).
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Aug 15, 2021)

    This new release of flutter_media_metadata adds & fixes:

    • Added Windows support.
    • Moved MediaMetadataRetriever.setDataSource & MediaMetadataRetriever.extractMetadata calls to another non-UI thread on Android.
    • Improved Linux support.
    • Added support for embedded album arts on Windows & Linux.
    • Changed API to be more async friendly by being just a single call, MetadataRetriever.fromFile.
    Source code(tar.gz)
    Source code(zip)
Owner
Harmonoid
An elegant music app. It's just for you. πŸ’œ
Harmonoid
🎞 Flutter media playback, broadcast & recording library for Windows, Linux & macOS. Written in C++ using libVLC & libVLC++. (Both audio & video)

dart_vlc Flutter media playback, broadcast, recording & chromecast library for Windows, Linux & macOS. Written in C++ using libVLC & libVLC++. Install

Hitesh Kumar Saini 417 Dec 29, 2022
Generate a new file by compressed video, and provide metadata. Get video thumbnail from a video path, supports JPEG/GIF. To reduce app size not using FFmpeg in IOS.

flutter_video_compress Generate a new path by compressed video, Choose to keep the source video or delete it by a parameter. Get video thumbnail from

ε€©ζ΅·γ‚‹γ‚Š 179 Dec 8, 2022
A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter

quick_usb A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter Usage List devices List devices with additional description Get device

Woodemi Co., Ltd 39 Oct 1, 2022
🎡 Elegant music app to play local music & YouTube music. Distributes music into albums & artists. Has playlists & lyrics. Windows + Linux + Android.

Harmonoid Elegant music app to play local music & YouTube music. Download Now ?? Windows, Linux & Android. Feel free to report bugs & issues. Loving t

Harmonoid 1.9k Aug 10, 2022
Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library.

Playify Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library. Playify was built using iOS's Medi

Ibrahim Berat Kaya 32 Dec 14, 2022
Flutter window blur & transparency effects for on Windows & Linux. πŸ’™

flutter_acrylic Window blur & transparency effects for Flutter on Windows & Linux Installation Mention in your pubspec.yaml. dependencies: ... flu

Hitesh Kumar Saini 438 Jan 2, 2023
Kabar Pagi adalah sebuah aplikasi media penyiaran berita sederhana yang bersumber pada newsapi.org, bertujuan untuk menampilkan kumpulan berita dari berbagai macam media yang ada di dunia, fokusnya terutama Indonesia.

Kabar Pagi Kabar Pagi adalah sebuah aplikasi media penyiaran berita sederhana yang bersumber pada newsapi.org, bertujuan untuk menampilkan kumpulan be

Yusril Rapsanjani 13 Apr 21, 2023
FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.

File Manager FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to fee

Devs On Flutter 52 Dec 30, 2022
Flutter plugin for notification read & reply

Reflex Flutter plugin for notification read & reply. Compatibility βœ… Android ❌ i

Devs On Flutter 14 Dec 20, 2022
A Flutter plugin that supports Pangle SDK on Android and iOS.

Thanks for non-commercial open source development authorization by JetBrains. η©Ώε±±η”² Flutter SDK `pangle_flutter`ζ˜―δΈ€ζ¬Ύι›†ζˆδΊ†ε­—θŠ‚θ·³εŠ¨η©Ώε±±η”² Android ε’Œ iOS SDKηš„ Flutter

null 121 Dec 2, 2022
A robust Flutter plugin for making payments via Paystack Payment Gateway. Completely supports Android and iOS

?? Paystack Plugin for Flutter A Flutter plugin for making payments via Paystack Payment Gateway. Fully supports Android and iOS. ?? Installation To u

Wilberforce Uwadiegwu 165 Jan 4, 2023
A flutter plugin for integrating razorpay payment gateway. Supports Android and iOS.

Flutter Razorpay Plugin A flutter plugin for razorpay integration for both android and ios. If you use this library in your app, please let me know an

Chetan Kaushik 28 Dec 13, 2022
Front-end of multiplayer web3 games implemented with Flutter to run on all platforms (Web, Android, iOS, Linux, Window, macOS, TV-OS)

Front-end of multiplayer web3 games implemented with Flutter to run on all platforms (Web, Android, iOS, Linux, Window, macOS, TV-OS)

R-Team 5 Nov 15, 2022
A Flutter application for Muslims that help them challenge and motivate themselves and their friends to read Azkar in a fun way.

A Flutter application for Muslims that help them challenge and motivate themselves and their friends to read Azkar in a fun way.

null 33 Oct 30, 2022
A simple Flutter app to Read and Download eBooks.

?? ?? Flutter eBook App A simple Flutter app to Read and Download books. The Books included in the app are from the Public Domain (Expired Copyright a

Festus Olusegun 1.9k Dec 31, 2022
Latest and easy-to-read news, all in your pocket πŸ“±

Observer-flutter About Flutter app for getting live news in different categories Tools used Inshorts News API v2 This API's documentation Get the App

null 3 Jul 13, 2022
Firebase Login... And Data Created ,Read, Update, Delete

flutter_application_2 A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you st

Jamirul islam (Joy) 2 Nov 30, 2022
Music reader for online data (Google Drive implementation). Cross platform goal : iOS, Android, MacOS, Windows

omusic A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this i

JeanNicolasdeLamballerie 0 Nov 30, 2021
Flutter Music Player - First Open Source Flutter based material design music player with audio plugin to play local music files.

Flutter Music Player First Open Source Flutter based Beautiful Material Design Music Player(Online Radio will be added soon.) Demo App Play Store BETA

Pawan Kumar 1.5k Jan 8, 2023