Detect sound is ended in THREE.PositionalAudio?
Three.Audio
is wrapper around a buffer source audio object. https://github.com/mrdoob/three.js/blob/ddab1fda4fd1e21babf65aa454fc0fe15bfabc33/src/audio/Audio.js#L12
It looks like it overrides the onended event and binds it to its own function, so we just do the same:
sound1.source.onended = function() {
console.log('sound1 ended');
this.isPlaying = false; /* sets Three wrapper property correctly */
};
We set isPlaying = false
because this is what Three's Audio onended function does, which we just overrode.
working pen: http://codepen.io/anon/pen/GoambE