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

Object in mediaFileReaders Array results in mediaFileReaders[i].canReadFile is not a function #31

Closed
vyorkin opened this issue Jul 6, 2016 · 7 comments

Comments

@vyorkin
Copy link

vyorkin commented Jul 6, 2016

I've got an empty Object in mediaFileReaders Array:

jsmediatags.js:2259 Uncaught TypeError: mediaFileReaders[i].canReadFile is not a function
_findFileReader @ jsmediatags.js:2259
_getFileReader @ jsmediatags.js:2252
read @ jsmediatags.js:2230
read @ jsmediatags.js:2199
(anonymous function) @ actions.ts:105
actions.ts:104 File

Using webpack + babel-loader without any plugins & presets.

@vyorkin
Copy link
Author

vyorkin commented Jul 6, 2016

@vyorkin
Copy link
Author

vyorkin commented Jul 6, 2016

I've changed it to be:

for (var i = 0; i < mediaFileReaders.length; i++) {
        var canReadFile = mediaFileReaders[i].canReadFile;
        if (typeof(canReadFile) === 'function' && canReadFile(this._file)) {
          return mediaFileReaders[i];
        }
      }

but now I'm getting: jsmediatags.js:2265 Uncaught Error: No suitable file reader found for,
this._file is a String and it equals to "test.mp3".

why does it expect a filename to match this regular expression? /^[a-z]+:\/\//i
I have only instances of File and FileEntry (I'm working on a Chrome App)

@aadsm
Copy link
Owner

aadsm commented Sep 9, 2016

Can you provide the music file that shows this error?

@vyorkin
Copy link
Author

vyorkin commented Sep 17, 2016

As I remember I was getting it for any/every file, e.g.
test.mp3.zip

@aadsm
Copy link
Owner

aadsm commented Sep 17, 2016

That's not an mp3 file, it's a wav actually. I looked into the file and didn't find any ID3 tags, maybe it's coded as RIFF tags? This library doesn't support RIFF tags at this point in time though.

@vyorkin
Copy link
Author

vyorkin commented Sep 18, 2016

yeah, sorry, I've forgotten to mention that
I use this tool https://github.com/sunny256/cwwav to generate wav files for testing purposes.

I mean, maybe it should fail with some error message that makes sense, e.g. "<filetype> is not supported" or smth like that

@NingerJohn
Copy link

I've got the same error while I use the following code to read tags from mp4 video

var jsmediatags = require("jsmediatags");
console.log(filedir)
jsmediatags.read(filedir, {
    onSuccess: function (tag) {
        console.log(tag);
    },
    onError: function (error) {
        console.log(':(', error.type, error.info);
    }
});

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