浏览代码

Fix soundSource being lost

David Catuhe 5 年之前
父节点
当前提交
c545104fa1
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/Audio/sound.ts

+ 4 - 0
src/Audio/sound.ts

@@ -746,6 +746,10 @@ export class Sound {
                             length = length || this._length;
                             offset = offset || this._offset;
 
+                            if (this._soundSource) {
+                                this._soundSource.stop();
+                            }
+
                             this._soundSource = Engine.audioEngine.audioContext.createBufferSource();
                             this._soundSource.buffer = this._audioBuffer;
                             this._soundSource.connect(this._inputAudioNode);