In an Ionic 3 app, I am trying to read ID3 tags from files stored on the SD card. I tried to use jsmediatags but only get various errors, including crashes.
I am able to import jsmediatags properly with:
import * as jsmediatags from 'jsmediatags';
The typical call to read a file’s tags would be similar to this:
const localFile: string = 'file:///storage/emulated/0/song.mp3';
jsmediatags.read(localFile, {
onSuccess: function(tags) {
console.log('RESOLVED - jsmediatags.read');
console.log(tags);
},
onError: function(error) {
console.log('REJECTED - jsmediatags.read');
console.log(error);
}
});
This always fails (I get ‘REJECTED - jsmediatags.read’ in the console).
I must say that I am perfectly able to play this same file with the Ionic native Media plugin. The path is correct, the file is playable and contains ID3 tags.
Note: I am only after Android compatibility (for the moment).