Live data from Hacker News

JavaScript mp3 decoder allows Firefox to play mp3 without flash

jsmad.org

51–60 of 99 posts

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

#52
post #50

Earlier quoted context omitted.

We would've loved to have that too when porting the mad code. Here's a quick overview: bytestream is our general I/O abstract class - there's much room for improvement because it works with Strings. substream allows to have a 'view' of a slice of a bytestream. filestream and ajaxstream are two implementations of bytestream, doing local File I/O (with the upcoming W3C File API) and XMLHttpRequest streaming. On Firefox…

Maybe it's a silly question, but how did you output sound after decoding the stream? I wasn't aware browser JavaScript had any APIs that work with sounds directly. There is Audio, but IIRC it just streams the file from the server. I've looked at the sources, but couldn't fine the part that would answer my question.

You're talking about the HTML5 tag.

We're using audiolib.js, which abstracts over Mozilla's Audio Data API and Chrome's Web Audio API - both of which allow direct access to the sound device :)

(And no, it's a really good question! More people should know about this stuff!)

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

#55

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.

Really? It's working on Chrome 13 for me, though because of how Chrome slows down JS execution when you switch to another tab, things can get... funky.

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

#56
post #32

I'm curious whether you came up with the logo after the fact, or whether you named it after the mag? I've been surprised at how blatantly some recent open source projects reference pop culture in ways that are just begging for a takedown order - cool.io is another. I suppose it may be worth it if you're primarily focused on getting noticed in the short term (perhaps to get investment or a good job offer), but long te…

Really, a takedown order? Under what authority?

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

#57

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.

To get it working on Chrome 13+, enable 'Web Audio API' in about:flags, then click relaunch.

It should then work - more or less :)

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

#58
post #51

Awesome! But... I'm not a JS guy. I can't contextualise this. How does this compare to HTML5 browser-based audio playing? Will this be a new way to make an audio button? Or does it go much deeper than that for JS apps?

From what I hear,the HTML5 tag implementation quality varies wildly. It hasn't been used much in production for desktop-targeted web apps. It is, however, quite popular on the iPlatforms, because you have no Flash there!

As far as I can tell, jsmad is not going to replace the HTML5 audio tag on mobile devices. However, it does constitute a nice legal workaround for MP3 in desktop browsers such as Firefox.

It gives access to the full decoded audio data, the code doing the playback (player.js) is actually just a tiny little part of jsmad! The HTML5 audio tag seems to also give access to the decoded data, but I haven't messed with it enough to know what's the level of control.

What would be really interesting though, would be something like streaming audio applications - completely flash-free, something that would be (imho) hard to achieve using the HTML5 tag.

My opinion is that it's wrong to try to add everything as browser built-ins. If the Javascript are powerful enough, why not use it to decode PDF/MP3/whatever? I'm guessing we won't see a video decoder for a few months more, but who knows? Things are moving fast.

So to answer your original question: it goes much deeper. For an audio button it would probably be overkill, but then again, why not?

Post reply on HN