Browse Source

Fix sound isPlaying when delayed stop

sebavan 6 years ago
parent
commit
6df5bd5654
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Audio/sound.ts

+ 2 - 2
src/Audio/sound.ts

@@ -743,16 +743,16 @@ export class Sound {
                 } else {
                     this._streamingSource.disconnect();
                 }
+                this.isPlaying = false;
             }
             else if (Engine.audioEngine.audioContext && this._soundSource) {
                 var stopTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;
                 this._soundSource.stop(stopTime);
-                this._soundSource.onended = () => { };
+                this._soundSource.onended = () => { this.isPlaying = false; };
                 if (!this.isPaused) {
                     this._startOffset = 0;
                 }
             }
-            this.isPlaying = false;
         }
     }