Audio.source undefined

Hi, how are you?

I’m facing a problem with audio.
I see a example of audio.onEnded that I need to override, but I can’t acess .source of audio because it says ‘undefined’.

 this.audioLoader.load(soundPath, ( buffer ) => {
    this.soundVoice = new THREE.Audio(listener);
    this.soundVoice.setBuffer( buffer );        
    this.soundVoice.play();
    console.log(this.soundVoice.source);  //returns undefined
 }

Are there any warnings in the browser console? It seems that Audio.source gets not set in Audio.play() for some reasons.

BTW: It seems to work fine in this live demo: https://jsfiddle.net/a5sd0tkj/

Man, lol. I woke up and I ran the code without change anything and the audio.source just worked.

I’m not crazy, I swear hahah. Thanks for your attention.

1 Like

I’m happy it’s not a bug in THREE.Audio:sweat_smile:

1 Like