summaryrefslogtreecommitdiff
path: root/frontend/site/audio/audio.player.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2021-04-06 18:57:56 +0200
committerJules Laplace <julescarbon@gmail.com>2021-04-06 18:57:56 +0200
commit3a35d6f81f4c17310baa29b0d077e8a70bf2f5dd (patch)
tree763e2ce13d9b8e64fa07fedae383a6b2cad4d86c /frontend/site/audio/audio.player.js
parent477bd86c8f1be01ec2fb2d1f99f964b78690d135 (diff)
nora text placement
Diffstat (limited to 'frontend/site/audio/audio.player.js')
-rw-r--r--frontend/site/audio/audio.player.js23
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 {