aadsm / jsmediatags

Media Tags Reader (ID3, MP4, FLAC)
Other
748 stars 128 forks source link

Bug: Error in reading remote MP3 files - Offset 1025 hasn't been loaded yet error #43

Closed jgill333 closed 7 years ago

jgill333 commented 7 years ago

There's an issue that I can't seem to get around when trying to read ID3 tags from any remote MP3 file. Offset 1025 hasn't been loaded yet. The issue occurs no matter which MP3 file I try and use (both the file size and duration of the MP3 do not seem to matter and it is always a 1025 offset error) and there have been some commits that attempt to solve issues like this issue like https://github.com/aadsm/jsmediatags/commit/92ccb2371f230d75e0efcbe4c57978f98bc45378.

Here is an example of the issue using the version of jsmediatags.js (https://github.com/aadsm/jsmediatags/blob/1c528cfb49fb756a7068bbf53bcd7be67648905b/dist/jsmediatags.js) from commit (https://github.com/aadsm/jsmediatags/commit/92ccb2371f230d75e0efcbe4c57978f98bc45378) which has not yet been made part of an official release, but appears to be targeted at fixing an issue similar to this.

View this example on JS Bin and view the console output: https://jsbin.com/larikexite/1/edit?html,console,output

image

var jsmediatags = window.jsmediatags;
    var mediaSrc = "https://<replace with remote url>";
    var reader = new jsmediatags.Reader(mediaSrc);
    reader.read({
      onSuccess: function(tag) {
        if (tag.tags) {
          tagsJson = JSON.stringify(tag.tags);
          console.log(tagsJson);
        }
      },
      onError: function(error) {
        // type: a parse data error will occur
        // info: "Offset 1025 hasn't been loaded yet."
        errorJson = JSON.stringify(error);
        console.log(errorJson);
      }
    });

Any help would be appreciated as this issue also likely occurs for others as well.

tom-sherman commented 7 years ago

I'm pretty sure this is a file dependant issue, I don't think loading it over the network is a factor. Does this error still happen if you run the code on the same file but on your local machine?

Could you share the file in your example? (don't upload to Github if copyrighted though)

jgill333 commented 7 years ago

Hello, I tried using a few different remote files served under different infrastructures (all supporting range request headers, etc.) and even for different files the error offset is in the same place.

Here is the file I used in the JSBin example: https://s3.amazonaws.com/jsmediatags-offset-issue/audio.mp3

aadsm commented 7 years ago

@jgill333 the commit you mention is already on master but I hadn't create the releases for the new versions. I just did and also added the tags so that different CDNs can pick it up.

You can check it working here: https://runkit.com/58993b217fa4e80015e5b69f/58993b217fa4e80015e5b6a0

jgill333 commented 7 years ago

Thanks @aadsm!