diff options
-rw-r--r-- | players.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/players.js b/players.js index be303fd..cc20667 100644 --- a/players.js +++ b/players.js @@ -80,6 +80,15 @@ module.exports.WebPlayer = class extends Player { playFile(file) { this.audioEl.src = file this.audioEl.play() + + return new Promise(resolve => { + const handleEnded = () => { + this.audioEl.removeEventListener('ended', handleEnded) + resolve() + } + + this.audioEl.addEventListener('ended', handleEnded) + }) } } |