Creating an audioJS player and delaying playback doesn't play
Closed this issue · 2 comments
MrBendel commented
It appears there's a missing logic path for creating an audioJS object and delaying the playback. shouldPlay gets set to true, but nothing happens after that.
MrBendel commented
Seems like a solution could work like:
this.callbackManager.register({
callback: this._play,
context: this
});
// if we want to play the sound again after stop //
if (this.buffer && this.shouldPlay) {
this.source = this.audioContext.createBufferSource();
this.source.buffer = this.buffer;
this.source.connect(this.audioContext.destination);
this.source.gain.value = this.volume;
this.source.loop = this.loop;
}
this.shouldPlay = true;
if (!this.isStarted) {
this._play();
}