From d7d419aae1bdf116e153915e5b3e5c1d61339f4e Mon Sep 17 00:00:00 2001 From: Villermen Date: Wed, 8 Jun 2016 01:21:55 +0200 Subject: [PATCH] Stop player when going back to base url --- src/client/scripts/helpers/Player.js | 4 ++++ src/client/scripts/main.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/client/scripts/helpers/Player.js b/src/client/scripts/helpers/Player.js index 00bc254..cf36fca 100644 --- a/src/client/scripts/helpers/Player.js +++ b/src/client/scripts/helpers/Player.js @@ -117,6 +117,10 @@ class Player { sample.howl.stop(); } + stopAll() { + this.samples.forEach((sample) => sample.howl.stop()); + } + progressStep() { const { playing } = this; diff --git a/src/client/scripts/main.js b/src/client/scripts/main.js index 3c69d7b..25b98a2 100644 --- a/src/client/scripts/main.js +++ b/src/client/scripts/main.js @@ -36,6 +36,8 @@ function updateFromHistoryState(state) { $('body').animate({ scrollTop: sampleTop - 100, }); + } else { + Player.instance.stopAll(); } }