📎 Webclip
Writing Web Audio API code that works in every browser
The post says developers can target the newer, standards-based Web Audio API while still supporting browsers that use prefixed names or older method names. It recommends using AudioContext-MonkeyPatch to alias prefixed APIs to unprefixed ones, then checking old names in the spec and updating code where needed.
Reading notes#
- AudioContext-MonkeyPatch normalizes the interface so code can use the modern Web Audio API style across Chrome, Opera, Safari, and Firefox.
- The library aliases newer method names such as
startandstopto older browser-specific names when needed. - Old code may still fail if it relies on methods that the library does not alias, such as
createGainNodeinstead ofcreateGain. - The post points readers to the spec section on old names and to a Mozilla article about porting
webkitAudioContextcode. - Firefox still lacks some node types mentioned in the post, including
MediaStreamAudioSourceNode,MediaElementAudioSourceNode, andOscillatorNode. - It suggests using
ScriptProcessorNodeas a possible workaround whenOscillatorNodeis not available. - Parameters must also be checked for Firefox support, and the post gives
PannerNodewith the default HRTF panning model as an example. - While support for that case had landed in Nightly, the post advises setting
panningModelto'equalpower'in the meantime. - To follow progress, the post recommends the Web Audio mailing list, the umbrella bug for Firefox implementation, and example projects that show compatibility choices.
