From 088efdeb0ec9b015c8d525d5e9358e1d1353f34d Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Mon, 30 Jan 2017 18:13:18 -0500 Subject: [PATCH] sounds track playing state --- src/SoundPlayer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SoundPlayer.js b/src/SoundPlayer.js index ae4722b..3afa5b8 100644 --- a/src/SoundPlayer.js +++ b/src/SoundPlayer.js @@ -27,6 +27,7 @@ SoundPlayer.prototype.stop = function () { if (this.bufferSource) { this.bufferSource.stop(); } + this.isPlaying = false; }; SoundPlayer.prototype.start = function () { @@ -39,12 +40,15 @@ SoundPlayer.prototype.start = function () { this.bufferSource.playbackRate.value = this.playbackRate; this.bufferSource.connect(this.outputNode); this.bufferSource.start(); + + this.isPlaying = true; }; SoundPlayer.prototype.finished = function () { var storedContext = this; return new Promise(function (resolve) { storedContext.bufferSource.onended = function () { + this.isPlaying = false; resolve(); }; });