From 477bd86c8f1be01ec2fb2d1f99f964b78690d135 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 6 Apr 2021 18:14:51 +0200 Subject: stop all sounds --- frontend/site/audio/audio.player.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'frontend/site/audio') diff --git a/frontend/site/audio/audio.player.js b/frontend/site/audio/audio.player.js index 17edeee..4f33d9d 100644 --- a/frontend/site/audio/audio.player.js +++ b/frontend/site/audio/audio.player.js @@ -31,9 +31,14 @@ export default class AudioPlayer { } playPage(page) { - const { background_audio_id, restart_audio } = page.settings + const { background_audio_id, restart_audio, stop_all_sounds } = page.settings // console.log('playPage', page) - if ( + if (stop_all_sounds) { + Object.keys(this.players).forEach(id => { + this.players[id].type = "done" + this.players[id].stop(true) + }) + } else if ( this.current_background_id && this.current_background_id !== background_audio_id && this.current_background_id in this.players -- cgit v1.2.3-70-g09d2