From 35c45970178bcac473fb6149cecde5b090542e84 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 26 Jan 2019 15:33:43 +0100 Subject: [PATCH] Can play forever songs --- assets/js/common/songPlayer.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/assets/js/common/songPlayer.js b/assets/js/common/songPlayer.js index 2a99a888..4d8b8d2b 100644 --- a/assets/js/common/songPlayer.js +++ b/assets/js/common/songPlayer.js @@ -29,6 +29,23 @@ class SongPlayer { * Play audio just once */ playOnce(){ + this.songElem.loop = false; this.songElem.play(); } + + /** + * Play song forever + */ + playForever(){ + this.songElem.loop = true; + this.songElem.play(); + } + + /** + * Stop song + */ + stop(){ + this.songElem.pause(); + this.songElem.currentTime = 0; + } } \ No newline at end of file