Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Suitable File Reader Found #147

Open
nicstronell opened this issue Jul 19, 2021 · 5 comments
Open

No Suitable File Reader Found #147

nicstronell opened this issue Jul 19, 2021 · 5 comments

Comments

@nicstronell
Copy link

nicstronell commented Jul 19, 2021

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.

@pseudosavant
Copy link

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.

@nicstronell
Copy link
Author

did not find a solution. switched to musicmetadata.js

@pseudosavant
Copy link

@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

@gfmoore
Copy link

gfmoore commented Apr 8, 2023

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

@gfmoore
Copy link

gfmoore commented Apr 9, 2023

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)
          }
        })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants