AudioContext.listener
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
AudioContext
接口的 listener
属性返回一个 AudioListener
对象,可以用来实现 3D 音频空间化。
值
AudioListener
对象。
示例
备注:如果需要完整的音频空间化例子,可以查看 panner-node 演示。
js
const audioCtx = new AudioContext();
// 旧式的 webkit/blink 浏览器需要一个前缀
// …
const myListener = audioCtx.listener;
规范
Specification |
---|
Web Audio API # dom-baseaudiocontext-listener |
浏览器兼容性
BCD tables only load in the browser