5 ms·
Here too, and please send us a tweet or so if you make something cool with it!
by jensnockert 15y ago
Here too, and please send us a tweet or so if you make something cool with it!
- Kudos 15y agoIt seems to stutter if you change tabs, is this due to restrictions in Firefox background tabs and timers? Edit: Awesome stuff, btw :D
- jensnockert 15y agoThe stuttering when in a background tab we think is related to timers yes, but we hope that properly buffering the audio will fix it.
- shrikant 15y agojsnockert'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. -----
- nddrylliog 15y agoThe 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 :)
- Kudos 15y agoFrom 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.
- nddrylliog 15y agoIf 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.