BaseAudioContext.listener

The listener property of the BaseAudioContext interface returns an AudioListener object that can then be used for implementing 3D audio spatialization.

Syntax

baseAudioContext.listener;

Value

An AudioListener object.

Example

Note: for a full Web Audio spatialization example, see our panner-node demo.

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

...

var myListener = audioCtx.listener;

Specifications

Specification
Web Audio API
# dom-baseaudiocontext-listener

Browser compatibility

BCD tables only load in the browser

See also