fasterthanlime / jsmad

:saxophone: Javascript MPEG-1 Audio Layer III (mp3) and ID3v2 decoder
http://audiocogs.org/codecs/mp3/
762 stars 41 forks source link

hi, can jsMad play MP3 files fully ```locally```? my work pc doesn't access network #14

Closed chenzx closed 13 years ago

chenzx commented 13 years ago

i hope this get resolved so can got a demo taste...

gliese1337 commented 13 years ago

It can in Firefox, at least. Chrome Canary throws a security exception for me, though.

chenzx commented 13 years ago

i mean my work pc network access to some URLs is blocked by firewall seems the ID3 tags are displayed but the MUSIC is NOT palying...

nddrylliog commented 13 years ago

So, the main demo (index.html, mhd.js is loading some files from remote servers such as jquery, the officialfm API, etc. - but those should not influence the playback of local files.

However, please, just don't try to play from file:/// - browsers are notorious for having all sorts of weird behavior and restrictive security when it comes to file:/// browsing. So just don't

My configuration for local testing is this:

I have nginx, which serves /var/www/jsmad/ on /, and listens on port 80 In my /etc/hosts file, I have "127.0.0.1 jsmad.org" which I uncomment when I want to test locally, and comment when I want to test the website.

chenzx commented 13 years ago

my system is Win XP sp3 using XAMPP, & modify the hosts file: 127.0.0.1 jsmad.org

BUT it still doesn't work.

FireBug report errors: this.state.buffer is undefined http://localhost/jsmad/src/ajaxstream.js Line 142

&: GET http://jsmad.org/musicbrainz/Bloc%20Party jQuery.js Line 7829 Uh oh, a free bitrate stream. We're fucked. First error! code = 565, recoverable ? = true

chenzx commented 13 years ago

wait... i got a idea: put mp3 files on XAMPP server? this is not very elegant, BUT, the demo can NOT open a URL !?

:-<

nddrylliog commented 13 years ago

The demo can open a URL, it's just not exposed in the UI, but the URL is "computed" in playOfm()

Also, what browser are you using? The 'this.state.buffer' is undefined has nothing to do with local/non-local.

On Tue, Jun 21, 2011 at 3:35 AM, chenzx < reply@reply.github.com>wrote:

wait... i got a idea: put mp3 files on XAMPP server? this is not very elegant, BUT, the demo can NOT open a URL !?

:-<

Reply to this email directly or view it on GitHub: https://github.com/nddrylliog/jsmad/issues/14#issuecomment-1407304

Amos Wenger Community Development Engineer official.fm - "The Do It Yourself Music Club" I'm @nddrylliog https://github.com/nddrylliog on GitHub

chenzx commented 13 years ago

hi i use Firefox 4.0.1 & i also had a update to 5.0 On Both jsMad does not work.

nddrylliog commented 13 years ago

Oh, one thing. Don't serve jsmad from a folder, this url shouldn't be:

http://localhost/jsmad/src/ajaxstream.js

but:

http://localhost/src/ajaxstream.js

Also, have you tried local files? Click browse and choose one of your MP3s? Cause that doesn't require any API calls, whereas playOfm() does requests to the Official.fm APi (and Musicbrainz and Musicmetric, although those aren't blocking)

Amos

On Tue, Jun 21, 2011 at 10:59 AM, chenzx < reply@reply.github.com>wrote:

hi i use Firefox 4.0.1 & i also had a update to 5.0 On Both jsMad does not work.

Reply to this email directly or view it on GitHub: https://github.com/nddrylliog/jsmad/issues/14#issuecomment-1408896

Amos Wenger Community Development Engineer official.fm - "The Do It Yourself Music Club" I'm @nddrylliog https://github.com/nddrylliog on GitHub

chenzx commented 13 years ago

I've just moved /jsmad/src/ajaxstream.js to /src/ajaxstream.js & then open a file:/// local mp3 file but it still doesn't work

the errors become different:

buffer underflow with absoluteAvailable! http://localhost/jsmad/src/ajaxstream.js Line 96

these errors poped up a lot in firebug.(I think perhaps it's not supporting my 320Kbps encoding mp3?)

chenzx commented 13 years ago

use another 192Kbps encoded mp3, ... seems *.js files should NOT be put above a directory level:

"NetworkError: 404 Not Found - http://localhost/jsmad/src/mad.js" mad.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/layer3.js" layer3.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/frame.js" frame.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/synth.js" synth.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/huffman.js" huffman.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/imdct_s.js" imdct_s.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/bytestream.js" bytestream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/substream.js" substream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/bit.js" bit.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/filestream.js" filestream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/id3v22stream.js" id3v22stream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/ajaxstream.js" ajaxstream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/stringstream.js" stringstream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/player.js" player.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/id3v23stream.js" id3v23stream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/mp3file.js" mp3file.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/rq_table.js" rq_table.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/stream.js" stream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/huffman.js" huffman.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/bit.js" bit.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/stream.js" stream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/layer3.js" layer3.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/frame.js" frame.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/synth.js" synth.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/bytestream.js" bytestream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/filestream.js" filestream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/substream.js" substream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/id3v22stream.js" id3v22stream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/id3v23stream.js" id3v23stream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/mp3file.js" mp3file.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/ajaxstream.js" ajaxstream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/stringstream.js" stringstream.js "NetworkError: 404 Not Found - http://localhost/jsmad/src/player.js" player.js Mad is not defined [在此错误处中断] Mad.Player.fromFile(file, usePlayer); mhd.js (第 158 行)

chenzx commented 13 years ago

after put the src/*.js files back to inside jsmad/, & use the 192Kbps mp3 file, a new error occurs:

this.playing 2 channels, samplerate = 44100 audio, mode 2 preloadbar is null http://localhost/jsmad/mhd.js Line 12

chenzx commented 13 years ago

Hi, i got jsMad working! just open file:///d:/xampp/htdocs/jsmad/index.html DIRECTLY & choose a local MP3 file and it starts playing...

At beginning it's very fluent, but after some time it lame-leg'ed

:-)

chenzx commented 13 years ago

it eats 15% CPU on my E7400 and seems when NOT played at foreground will be very lagging

nddrylliog commented 13 years ago

when NOT played at foreground will be very lagging

That has been fixed in the latest version. It's a Firefox bug we (jussi from audiolib.js) had to work around.

On Tue, Jun 21, 2011 at 1:20 PM, chenzx < reply@reply.github.com>wrote:

it eats 15% CPU on my E7400 and seems when NOT played at foreground will be very lagging

Reply to this email directly or view it on GitHub: https://github.com/nddrylliog/jsmad/issues/14#issuecomment-1409531

Amos Wenger Community Development Engineer official.fm - "The Do It Yourself Music Club" I'm @nddrylliog https://github.com/nddrylliog on GitHub

nddrylliog commented 13 years ago

Closing.