Capacitor read audio files with meta data

in my capacitory app i use file system to read and filter audio files but file system those not work very fast and those not return audio meta data then i use music-metadata-browser npm package to get the audio file meta data

the problem is that it very slow adding external package for metada make it even more slow

is there any better solution to this?

We have tackled this issue in a few projects at Impero IT Services, while working on a cross-platform music catalog app built with Ionic + Capacitor.

True, using the Capacitor File System plugin to fetch files is functional but not optimized for speed, when handling larger directories. Adding music-metadata-browser further compounds the issue because it’s designed for browser-based usage and loads the entire file, which slows down performance significantly on mobile.

Solution:

  1. Native Plugins for Metadata

if target audience Android/iOS, use an existing Capacitor native plugin

  • MediaMetadataRetriever on Android
  • AVFoundation on iOS

These API will read audio metadata directly from the file header without loading the entire file.

Can either

  • Wrap them in your own Capacitor plugin
  • Or use plugins like cordova-plugin-media with caveats

We did this for an iOS-heavy music archive app and saw metadata loading speed improve by ~5x compared to browser-based JS solutions.

  1. Try offloading the heavy lifting to a Web Worker, If you are sticking to browser-based metadata parsing

  2. Cache Metadata After First Load

Once metadata is retrieved the first time, store it locally (SQLite, IndexedDB, simple JSON file) with a timestamp. That way, subsequent loads do not need to reprocess files unless they have changed.

This caching mechanism saved us tons of time on an audio learning app with 1,000+ tracks.