AudioContext.listener

AudioContextlistener 属性返回一个 AudioListener 对象,可以用来实现 3D 音频空间化。

语法

var audioCtx = new AudioContext();
var myListener = audioCtx.listener;

返回值

An AudioListener object.

例子

备注: 想要完整的音频空间化例子,可以查看panner-node DEMO

var AudioContext = window.AudioContext || window.webkitAudioContext;
var audioCtx = new AudioContext();
// Older webkit/blink browsers require a prefix

...

var myListener = audioCtx.listener;

规范

Specification
Web Audio API
# dom-baseaudiocontext-listener

浏览器兼容性

BCD tables only load in the browser

另见