Getting Better Access to Sound with the Web Audio API
As you saw in Chapter 25, “Playing Sounds, the Mobile Achilles’ Heel,” sound in HTML5 on mobile devices is not well supported. The good news is that an extremely rich Audio API called the Web Audio API has made its way into the desktop versions of Chrome and Safari. The API can be a little daunting because it’s low level but feature rich and is something a game developer would be used to rather than a web developer. The most recent published specification is available at www.w3.org/TR/webaudio.
If it gains wider browser support, the Web Audio API can provide a powerful audio layer for HTML5 games, enabling real-time creation and mixing of effects and music via JavaScript.
As of this writing Apple has announced that iOS 6 will have support for the audio API, but what level of support this will be and what restrictions will be placed on playing audio are yet to be determined. Because the Web Audio API is a project that Google first implemented in Chrome, it appears likely that the API will make its way into Chrome for Android in the near future.
As of this writing neither Microsoft, Mozilla, or Opera have announced any intention to support the API.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access