Code Monkey home page Code Monkey logo

mp3-parser's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mp3-parser's Issues

uncaught range error leads to crash with some mp3s

mp3-parser\lib\lib.js:223 Uncaught RangeError: Invalid typed array length

return String.fromCharCode.apply(null, new Uint16Array(buffer, offset, length / 2));
^
RangeError: Invalid typed array length
at new Uint16Array (native)
at Object.lib.readStr.ucs (node_modules\mp3-parser\lib\lib.js:223:52)
at readFrameContentIpls (node_modules\mp3-parser\lib\id3v2.js:331:53)
at Object.mp3Id3v2Parser.readId3v2TagFrame (node_modules\mp3-parser\lib\id3v2.js:559:28)
at Object.mp3Id3v2Parser.readId3v2Tag (node_modules\mp3-parser\lib\id3v2.js:638:36)
at Object.mp3Parser.readId3v2Tag (node_modules\mp3-parser\main.js:113:28)

Stream chunks with socket.io

Hi, with this package, I can make a streaming of mp3 file with socket.io??...

Something like this using your example file

var fs = require("fs"),
    io = require('socket.io')(),
    util = require("util"),
    mp3Parser = require("mp3-parser"),
    toArrayBuffer = function (buffer) {
        var bufferLength = buffer.length, i = 0,
            uint8Array = new Uint8Array(new ArrayBuffer(bufferLength));

        for (; i < bufferLength; ++i) { uint8Array[i] = buffer[i]; }
        return uint8Array.buffer;
    };

io.on('connection',function(socket){
socket.on('audio',function(data){
fs.readFile(data.pathToMp3, function (error, buffer) {
    if (error) {
        console.log("Oops: " + error);
        process.exit(1);
    }
    buffer = new DataView(toArrayBuffer(buffer));

    var lastFrame = mp3Parser.readLastFrame(buffer),
        tags = mp3Parser.readTags(buffer);


//how i send the chuck to the server? socket.send('chunk',tags)??

});
});
});

./lib/lib set as mp3ParserLib on globals but referenced as lib in global import statements

I'm trying to use this in an ember-cli project via the global method. I couldn't get mp3-parser to load until I realized that the lib/lib.js module was undefined in all the consuming modules. It looks like the culprit are these lines:

https://github.com/biril/mp3-parser/blob/master/lib/id3v2.js#L34
https://github.com/biril/mp3-parser/blob/master/lib/xing.js#L34
https://github.com/biril/mp3-parser/blob/master/main.js#L34

Once I changed these to reference globalObject. mp3Parserlib it worked. That name is defined here:
https://github.com/biril/mp3-parser/blob/master/lib/lib.js#L26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.