WebXR does not seem to be compatible with positional audio, specifically when put in VR mode. The audio would start stuttering once you are near the audio source and I suspect it is because the audio listener is switching between the left eye position and right eye position rapidly.
However, positional audio seems to work fine in A-Frame, which is based on three.js, so I wonder if there is an easy fix to this, or even if its expected behavior?
- Set up a XR enabled renderer
- Add a PositionalAudio object to the scene with anything in the audioBuffer
- Enter XR mode and approach the object. Audio stutters.
The code is a bit too long to be put here so I created a repo.
Hosted with github pages here.
AudioListener would follow the position of the XR camera.
- Device: [Desktop, Mobile, VR]
- OS: [Windows, MacOS, Linux, Android, iOS]
- Browser: [Chrome, Firefox, Safari, Edge]
- Three.js version: [r123]