Audio Listener
The Audio Listener represents the virtual listener in the 3D space.
It can be accessed as a member of the Space:
Space.audioListener
.The listener can be moved around in the space by changing its position and orientation.
All audio objects (including Remote Participants)
are rendered relative to the listener's position and orientation.
Basic Usage
Position the virtual listener
const audioListener = space.audioListener;
audioListener.setPosition(2, 1, 4);
// set orientation
const forwardVector = { x: 0, y: 0, z: -1 };
const upVector = { x: 0, y: 1, z: 0 };
audioListener.setOrientation(forwardVector, upVector);
All setters have accompaning getters. For example,
audioListener.getPosition()
returns the current position of the listener.Further Reading
Checkout the
AudioListener
's API Reference for alternative orientation setters using Quaternions or Euler angles.