diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-04-06 18:57:56 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-04-06 18:57:56 +0200 |
| commit | 3a35d6f81f4c17310baa29b0d077e8a70bf2f5dd (patch) | |
| tree | 763e2ce13d9b8e64fa07fedae383a6b2cad4d86c /frontend/site/audio/audio.player.js | |
| parent | 477bd86c8f1be01ec2fb2d1f99f964b78690d135 (diff) | |
nora text placement
Diffstat (limited to 'frontend/site/audio/audio.player.js')
| -rw-r--r-- | frontend/site/audio/audio.player.js | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/frontend/site/audio/audio.player.js b/frontend/site/audio/audio.player.js index 4f33d9d..e6e8f44 100644 --- a/frontend/site/audio/audio.player.js +++ b/frontend/site/audio/audio.player.js @@ -25,6 +25,13 @@ export default class AudioPlayer { ) } + stop(id) { + if (this.players[id]) { + this.players[id].type = "done" + this.players[id].stop() + } + } + done(id) { // console.log('remove', id) delete this.players[id] @@ -34,10 +41,7 @@ export default class AudioPlayer { const { background_audio_id, restart_audio, stop_all_sounds } = page.settings // console.log('playPage', page) if (stop_all_sounds) { - Object.keys(this.players).forEach(id => { - this.players[id].type = "done" - this.players[id].stop(true) - }) + Object.keys(this.players).forEach(id => this.stop(id)) } else if ( this.current_background_id && this.current_background_id !== background_audio_id @@ -88,6 +92,17 @@ export default class AudioPlayer { return this.players[id] } } + + playURL({ id, url }) { + this.players[id] = new Player({ + item: { id, url }, + tile: { settings: {} }, + type: "url", + done: this.done + }) + this.players[id].play() + return this.players[id] + } } class Player { |
