Live data from Hacker News

JavaScript mp3 decoder allows Firefox to play mp3 without flash

jsmad.org

21–30 of 99 posts

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#22

As a wise Keanu Reeves once said, "Woah." Is there any upper limit you've found with bitrates, etc.? Also, what was the most difficult part in building this?

Been playing 320kbps Stereo flawlessly afaik. The bitrate is really not much of an issue. Browsers have a much harder time dealing with binary XHRs, huge typed arrays, huge strings, and a real fucking lot of arithmetic operations. I think the most difficult part was the debugging. Jens Nockert, Matthias Georgi & I finally used node.js and carefully diff'd the output from minimad.c (the canonical libmad example) and j…

*52 Bit.

And I agree, debugging it was a special experience.

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#23
post #21

jsmad lead developer here, shoot if you have any questions!

Did you intentionally take a stab at Atwood's law?

I'll dig up the mathematician in me and answer to a generalized version of this question:

"Are you aware that this is probably one of the most inane use of Javascript and did you do it to piss people off?"

To both questions the answer is: Yes, absolutely.

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#26

Doesnt work for me (no audio): Chrome 12 on Ubuntu 10.10 64-bit Youtube is playing fine. Here's the Chrome debugger log: http://pastebin.com/MwqfD1K5

No, it does not work in Chrome yet, only Firefox 4+ (or Aurora etc). But it is on the roadmap.

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#27

Doesnt work for me (no audio): Chrome 12 on Ubuntu 10.10 64-bit Youtube is playing fine. Here's the Chrome debugger log: http://pastebin.com/MwqfD1K5

Yes, as said in the README, the audio output doesn't work on Chrome. I have no idea why - audiolib.js should support it. Maybe we're just using it wrong?

If the audiolib.js dev is here or anyone else has a clue, it'd be very welcome.

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#28
post #16

Earlier quoted context omitted.

The answer to this is complex, and I've spent the last night tuning the player so that it wouldn'd do that. There are several scenarios here: 1) Either the MP3 data buffer doesn't fill fast enough (slow network transfer), so when it runs out of buffer, all hell breaks loose. This is because player.js is really naive, so more a demo bug than a jsmad bug. 2) Or Firefox fails to call the scheduled tasks (via setTimeout)…

From the Firefox 5RC1 release notes: > Background tabs have setTimeout and setInterval clamped to 1000ms to improve performance As far as I'm aware, Chrome does this also but I'm not sure what version it was introduced in.

If we could find a way to increase the audio buffer size in audiolib.js (the refill buffer it's giving us pretty small although we have a big preBufferSize) it'd probably be enough.

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#29

Doesnt work for me (no audio): Chrome 12 on Ubuntu 10.10 64-bit Youtube is playing fine. Here's the Chrome debugger log: http://pastebin.com/MwqfD1K5

Yes, as said in the README, the audio output doesn't work on Chrome. I have no idea why - audiolib.js should support it. Maybe we're just using it wrong? If the audiolib.js dev is here or anyone else has a clue, it'd be very welcome.

Mozilla's audio API allows for more control than chrome's latest stable. If you're using the latest snapshot, it should work.
Post reply on HN