News for hackers. Stuff that matters.
Re:JavaScript mp3 decoder allows Firefox to play mp3 without... by jensnockert on Friday June 17, 2011 @10:50AM (#2665694)
Here too, and please send us a tweet or so if you make something cool with it!
Re:JavaScript mp3 decoder allows Firefox to play mp3 without... by Kudos on Friday June 17, 2011 @10:55AM (#2665719)
It seems to stutter if you change tabs, is this due to restrictions in Firefox background tabs and timers?

Edit: Awesome stuff, btw :D

Re:JavaScript mp3 decoder allows Firefox to play mp3 without... by shrikant on Friday June 17, 2011 @11:01AM (#2665755)
jsnockert's reply to this is dead for some reason:

---

jensnockert 3 minutes ago | link [dead]

The stuttering when in a background tab we think is related to timers yes, but we hope that properly buffering the audio will fix it.

-----

Re:JavaScript mp3 decoder allows Firefox to play mp3 without... by nddrylliog on Friday June 17, 2011 @11:02AM (#2665757)
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) for more than the length of a sound buffer, and then the audio device just stops. If the audio device stops updating for more than 500ms, player.js just resets the audio device and tries again.

3) And worst case: something goes really wrong, the rebuffer is called but audio is no longer being played. I have no idea what happens here, I'm laying the blame somewhere between Firefox 4 and audiolib.js (which is awesome btw).

So yeah, apparently browsers are really bad at scheduling CPU and IO-intensive concurrent things. It shows when streaming a large file - been listening to 1h+ mixes, which works, but stutters a lot in the beginning.

Just giving the mozilla devs a good benchmark to optimize for :)

Re:JavaScript mp3 decoder allows Firefox to play mp3 without... by Kudos on Friday June 17, 2011 @11:16AM (#2665809)
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.

Re:JavaScript mp3 decoder allows Firefox to play mp3 without... by nddrylliog on Friday June 17, 2011 @11:32AM (#2665875)
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.