This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
The AudioListener interface represents the position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute.
It is important to note that there is only one listener per context and that it isn't an AudioNode.
Note: The position, forward, and up value are set and retrieved using different syntaxes. Retrieval is done by accessing, for example, AudioListener.positionX, while setting the same property is done with AudioListener.positionX.value. This is why these values are not marked read only, which is how they appear in the specification's IDL.
AudioListener.positionXRepresents the horizontal position of the listener in a right-hand cartesian coordinate system. The default is 0.
AudioListener.positionYRepresents the vertical position of the listener in a right-hand cartesian coordinate system. The default is 0.
AudioListener.positionZRepresents the longitudinal (back and forth) position of the listener in a right-hand cartesian coordinate system. The default is 0.
AudioListener.forwardXRepresents the horizontal position of the listener's forward direction in the same cartesian coordinate system as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0.
AudioListener.forwardYRepresents the vertical position of the listener's forward direction in the same cartesian coordinate system as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0.
AudioListener.forwardZRepresents the longitudinal (back and forth) position of the listener's forward direction in the same cartesian coordinate system as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is -1.
AudioListener.upXRepresents the horizontal position of the top of the listener's head in the same cartesian coordinate system as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0.
AudioListener.upYRepresents the vertical position of the top of the listener's head in the same cartesian coordinate system as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 1.
AudioListener.upZRepresents the longitudinal (back and forth) position of the top of the listener's head in the same cartesian coordinate system as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0.
AudioListener.setOrientation() Deprecated
Sets the orientation of the listener.
AudioListener.setPosition() Deprecated
Sets the position of the listener.
Note: Although these methods are deprecated they are currently the only way to set the orientation and position in Firefox (see Firefox bug 1283029).
The setOrientation() and setPosition() methods have been replaced by setting their property value equivalents. For example setPosition(x, y, z) can be achieved by setting positionX.value, positionY.value, and positionZ.value respectively.
See BaseAudioContext.createPanner() for example code.
| Specification |
|---|
| Web Audio API> # AudioListener> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
AudioListener |
14 | 12 | 25 | 15 | 6 | 18 | 25 | 14 | 6 | 1.0 | 4.4.3 | 6 |
forwardX |
52 | 79 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
39 | 14.1 | 52 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
41 | 14.5 | 6.0 | 52 | 14.5 |
forwardY |
52 | 79 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
39 | 14.1 | 52 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
41 | 14.5 | 6.0 | 52 | 14.5 |
forwardZ |
52 | 79 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
39 | 14.1 | 52 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
41 | 14.5 | 6.0 | 52 | 14.5 |
positionX |
52 | 79 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
39 | 14.1 | 52 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
41 | 14.5 | 6.0 | 52 | 14.5 |
positionY |
52 | 79 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
39 | 14.1 | 52 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
41 | 14.5 | 6.0 | 52 | 14.5 |
positionZ |
52 | 79 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
39 | 14.1 | 52 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
41 | 14.5 | 6.0 | 52 | 14.5 |
setOrientation |
14 | 12 | 25 | 15 | 6 | 18 | 25 | 14 | 6 | 1.0 | 4.4.3 | 6 |
setPosition |
14 | 12 | 25 | 15 | 6 | 18 | 25 | 14 | 6 | 1.0 | 4.4.3 | 6 |
upX |
52 | 79 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
39 | 14.1 | 52 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
41 | 14.5 | 6.0 | 52 | 14.5 |
upY |
52 | 79 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
39 | 14.1 | 52 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
41 | 14.5 | 6.0 | 52 | 14.5 |
upZ |
52 | 79 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
39 | 14.1 | 52 | NoSupports a deprecated way of setting orientation - thesetOrientation() method. |
41 | 14.5 | 6.0 | 52 | 14.5 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AudioListener