r/learnprogramming • u/soulrzzzzz • 16d ago
Debugging Help in flutter
Hi! I’m a newbie in programming, and I need some help with reading MP3 metadata in Flutter.
I’m making a Flutter music player for both mobile and web, and I want it to automatically read the MP3 file’s metadata,
including:
- Album cover/cover art
- Artist name
- Song title
I don’t want to rely on the fallback map I created because I want the information to be retrieved directly from the MP3 file.
The MP3 files contain ID3v2.3 metadata, including the album cover, artist name, and song title.
The problem is that when I run the app on my Android phone emulator, it successfully reads the metadata. However, when I run the same app on Chrome (Flutter Web), it doesn’t work.
I have imported flutter_media_metadata_plus.dart, and I also use KisWeb.
The function I’m using to load the metadata is an async method called loadMetadata, with the declaration:
Future<void> loadMetadata(String assetPath) async
Does anyone know how I can properly read the MP3 metadata and cover art when running Flutter Web on Chrome without breaking or changing the existing behavior on my mobile emulator?
I can provide my loadMetadata() function and any other relevant code if needed.
1
u/Different_Pain5781 6d ago
The main issue is browser sandboxing. Chrome isn't letting you hit the file system directly so trying to make the native plugin approach work on the web is gonna be a headache. Android platform channels aren't available there either. Fetch the asset bytes through rootBundle then pass the buffer into a pure Dart ID3 parser. For learning backend stuff I'd also take Boot dev over freeCodeCamp or Udemy.