javascript - Getting musicmetadata to work in the browser -


here library i'm trying use:

https://github.com/leetreveil/musicmetadata

there docs showhow use it, docs uses function called fs.createreadstream open file. functionality users of node, , believe not avilable (or not applicable) in browser enviornment. assume need use filereader? file in case going come <input> field.

here example library's docs:

var parser = mm(fs.createreadstream('sample.mp3'), function (err, metadata) { if (err) throw err;   console.log(metadata); }); 

i tried using didn't work:

$("input[type=file]").change(function(event) {     var reader = new filereader();     reader.onload = function(e) {         var blob = reader.result;         var parser = new musicmetadata(blob);          parser.on('metadata', function (result) {             console.log("mp3 tags!!!", result);         });     }              reader.readasbinarystring($(this)[0].files[0]); }); 

edit: discovered browser example: https://github.com/leetreveil/musicmetadata/blob/master/example/index.html

my code this:

$("input[type=file]").change(function(event) {     var parser = musicmetadata($(this)[0].files[0]);     parser.on('metadata', function(result) {         console.log("mp3 tags!!!");     }); }); 

when run error:

uncaught typeerror: cannot read property 'hasownproperty' of undefined 


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -