diff --git a/src/SoundPlayer.js b/src/SoundPlayer.js index 1a67b7f..ed73a78 100644 --- a/src/SoundPlayer.js +++ b/src/SoundPlayer.js @@ -75,12 +75,11 @@ class SoundPlayer { * @return {Promise} a Promise that resolves when the sound finishes playing */ finished () { - const storedContext = this; return new Promise(resolve => { - storedContext.bufferSource.onended = function () { + this.bufferSource.onended = () => { this.isPlaying = false; resolve(); - }.bind(storedContext); + }; }); } }