html - Future of JavaScript audio? - Stack Overflow

admin2025-04-20  0

I'm teaching kids how to add audio to their JavaScript games and webpages. I knew about the HTML5 Audio API and am just now learning about the issues around the various browsers (IE surprisingly doesn't support WAV at all, etc).

However, apparently there's a new Web Audio standard I was unaware of. Chrome fully supports it. Mozilla states the following about Web Audio and Firefox:

Firefox currently supports the inpatible, Mozilla-specific Audio Data API, but it is marked as "deprecated" in favor of the W3C standard. Work has started to support the new Web Audio API in Firefox.

caniuse reports the following about support for Web Audio API.

I don't mind at all forcing the kids to use Google Chrome for development and sound not working in many other browsers. However, I don't want to be teaching them something that will not be in other browsers in the future.

I'm also reading about a possible alternative to Web Audio called MediaStreaming... Which is the future that I should be teaching?

I'm teaching kids how to add audio to their JavaScript games and webpages. I knew about the HTML5 Audio API and am just now learning about the issues around the various browsers (IE surprisingly doesn't support WAV at all, etc).

However, apparently there's a new Web Audio standard I was unaware of. Chrome fully supports it. Mozilla states the following about Web Audio and Firefox:

Firefox currently supports the inpatible, Mozilla-specific Audio Data API, but it is marked as "deprecated" in favor of the W3C standard. Work has started to support the new Web Audio API in Firefox.

caniuse. reports the following about support for Web Audio API.

I don't mind at all forcing the kids to use Google Chrome for development and sound not working in many other browsers. However, I don't want to be teaching them something that will not be in other browsers in the future.

I'm also reading about a possible alternative to Web Audio called MediaStreaming... Which is the future that I should be teaching?

Share Improve this question asked Mar 13, 2013 at 19:30 at.at. 52.6k105 gold badges304 silver badges471 bronze badges 7
  • Isn't this the only cross browser solution? stackoverflow./questions/450033/… – The Muffin Man Commented Mar 13, 2013 at 19:32
  • @Nick - The HTML5 Audio API is better than that – at. Commented Mar 13, 2013 at 19:41
  • Here's where the HTML5 API can be used: caniuse./#feat=audio-api – Diodeus - James MacFarlane Commented Mar 13, 2013 at 19:44
  • 1 I would stick with the HTML5 in the long run. – Diodeus - James MacFarlane Commented Mar 13, 2013 at 19:44
  • The future is is obviously HTML5 IMO. – The Alpha Commented Mar 13, 2013 at 19:57
 |  Show 2 more ments

5 Answers 5

Reset to default 4

Strictly speaking, there's really no HTML5 Audio API. But HTML5 did introduce the <audio/> element, which is great for simple use-cases.

If you need high-precision timing, or the ability to perform DSP -- I'd go with the Web Audio API. It's still a draft as far as the W3C is concerned, but it seems fairly clear that this is the direction they're going in: http://www.w3/2011/audio/wiki/PubStatus

There is no promise that the web audio API will be in all browsers but it is available in Chrome,Safari,and supposedly scheduled for Firefox. Opera has just changed their engine to webkit which is the engine used for the current batch of Web Audio API supporting browsers. Internet Explorer is pletely up in the air.

If all you need to do is play audio files, I would strongly remend using howler.js. It doesn't have a ton of features, but it is very reliable, and works well across browsers.

The Web Audio API is definitely 'the future' of audio on the web, but it can be pretty plicated, especially if you're trying to teach it to children.

I read somewhere that microsoft is also getting engaged in the web audio api and others

Also some features like capturing audio are only supported by canary or has this changed lately? When will the entire API be supported by the standard chrome webbrowser? Another problem I had with the audio API is that when you have to do some calculations for DSP as Kevin Ennis mentioned, then javascript has problems to do so and your browser crashes. I tried to figure out why it crashes but all I could find is that javascript is not the rights choice for heavy calculations. So as far as web audio API supporting DSP I'm not convinced.

I think it will still take a lot of time since you can create a website that uses web audio API and that will be supported in a lot of browsers and that will not crash randomly. But there is not real other choice for the moment so in the future I am guessing that more and more browsers will start supporting it.

If you are expecting the game should run only in the modern browsers you can checkout the audio library musquito. It's relatively new and it's pletely based on Web Audio API.

musquito also supports audio sprites that helps very much in games.

If you are looking for a fallback mechanism for older browsers then howler.js is a good option.

[Disclaimer: I'm the creator of musquito]

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745121174a286154.html

最新回复(0)