diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-04-19 16:47:28 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-04-19 16:47:28 +0200 |
| commit | c5a6bfea8aa89900ae6d072313eef02948c79658 (patch) | |
| tree | 1a201c3d6d1356ee8aeaaed22068c62ae61d9caa /frontend/site/audio/audio.player.js | |
| parent | 03b78c302023ff296a8b4200801fa9de7291eed8 (diff) | |
mute button. muting audio
Diffstat (limited to 'frontend/site/audio/audio.player.js')
| -rw-r--r-- | frontend/site/audio/audio.player.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/frontend/site/audio/audio.player.js b/frontend/site/audio/audio.player.js index d036347..fcdcb6f 100644 --- a/frontend/site/audio/audio.player.js +++ b/frontend/site/audio/audio.player.js @@ -37,9 +37,14 @@ export default class AudioPlayer { delete this.players[id] } + toggleMuted(muted) { + this.muted = muted + Object.keys(this.players).forEach(id => this.players[id].toggleMuted(muted)) + } + playPage(page) { const { background_audio_id, restart_audio, stop_all_sounds } = page.settings - console.log('playPage', page) + // console.log('playPage', page) if (stop_all_sounds && this.current_background_id !== background_audio_id) { Object.keys(this.players).forEach(id => this.stop(id)) } else if ( @@ -86,8 +91,9 @@ export default class AudioPlayer { item, tile, type, - done: this.done + done: this.done, }) + this.players[id].toggleMuted(this.muted) this.players[id].play() return this.players[id] } @@ -100,6 +106,7 @@ export default class AudioPlayer { type: "url", done: this.done }) + this.players[id].toggleMuted(this.muted) this.players[id].play() return this.players[id] } @@ -120,6 +127,10 @@ class Player { this.audio.src = item.url } + toggleMuted(muted) { + this.audio.muted = muted + } + release() { if (this.type === 'click' && this.tile && this.tile.settings.navigate_when_audio_finishes) { history.push(this.tile.href) |
