var audiolistener = new THREE.AudioListener();
camera.add( me.audiolistener );
var sound = new THREE.Audio( audiolistener );
var audioLoader = new THREE.AudioLoader();
audioLoader.load( 'SOMEAUDIO.wav', function( buffer ) {
sound.setBuffer( buffer );
sound.setLoop(false);
sound.setVolume(0.5);
sound.play();
});
this works on android browsers, and desktop
i just spent a lot of time figuring this out because i want to use positional audio for a web project and finally got it working, so i figured i’d share here since this got me going in the right direction. basically the
source
comes from theaudioListener
context.this is in my
init
function:seems to work on mobile safari and chrome, though only tested on my iphone.
here’s the test version:
https://owenroberts.github.io/char/sound.html