aadsm/jsmediatags

No Suitable File Reader Found

nicstronell opened this issue · 5 comments

Hello. Sorry to bug you. I'm trying to get tags from a file I'm loading from Google Drive in Javasript.

here's a sample

function whenGetSong(songID){
	return gapi.client.drive.files.get({
		fileId: songID,
		alt: 'media'
	});
}

function getSongTags(googleID){
	whenGetSong(googleID).then((res)=>{
	jsmediatags.read(res.body, {
		onSuccess: function(tag) {	
			console.log('tag', tag);
		},
		onError: function(error) {
			console.log('error', error);
		}
	});					
}

but I get 'No Suitable File Reader Found'.

Any ideas?

Thanks.

Hey @nicstronell, did you ever find a solution to your problem? I'm encountering the exact same error. When I test the URL with the XhrFileReader regex test it passes.

did not find a solution. switched to musicmetadata.js

@nicstronell Thanks for the recommendation! Got it working with musicmetadata.js, in the browser even, within 10 minutes.

https://glitch.com/edit/#!/read-mp3?path=script.js%3A24%3A3

What does this error actually mean. I'm going round and round in circles here and I've tried every tag reader I can find and getting nowhere...(it's very very late)

I just want to read the tag of a local file, I don't need to input it, just read it from the browser and the file is in the same directory...

       var jsmediatags = window.jsmediatags;
        var tags = {};
        jsmediatags.read('test1.mp3', {
          onSuccess: function(tag) {
            tags = tag;
          }, 
          onError: function(error) {
            // handle error
            console.log(error);
          }
        });

I have the link to the minimised script in my html

Just to let you know, that by using the precursor to this package - JavaScript-ID3-Reader I am able to read an mp3 file directly from a pure JavaScript file - So it can be done :) The mp3 file is in the same directory as my html/css/javascript on the server. (Actually there is a soft symlink to where they are...)
And just for anyone struggling like I did here is the ID3 code to get the album art

       var trak = 'test.mp3'
        ID3.loadTags(trak, function() {
          var tags = ID3.getAllTags(trak)
          base64String = ""
          for (var i = 0; i < tags.picture.data.length; i++) {
            base64String += String.fromCharCode(tags.picture.data[i]);
          }
          var dataUrl = "data:" + tags.picture.format + ";base64," + window.btoa(base64String);
          $('#albumCover').attr('src', dataUrl)  //an img element
          //console.log(tags.track + '  ' + tags.picture.data)
        },
        {
          tags: ["track", "picture"],
          onError: function(reason) {
            console.log('GM Get image: ' +  reason)
          }
        })