This commit is contained in:
2026-10-18 19:17:40 +07:00
parent 9542330125
commit c10ed2db01
10 changed files with 283 additions and 9 deletions
+9
View File
@@ -15,6 +15,7 @@ const imageError = ref(false)
const timerDisplay = useScreenTimer(() => state.value)
const bridge = window.screenBridge!
let player: MediaPlayer | undefined
let disposed = false
let unsubscribe: (() => void) | undefined
let revision = -1
let sceneToken = ''
@@ -86,6 +87,7 @@ async function prepareScene(snapshot: State) {
}
}
function apply(value: State) {
if (disposed) return
if (value.revision <= revision) return
revision = value.revision
state.value = value
@@ -97,6 +99,12 @@ function apply(value: State) {
}
}
onMounted(async () => {
try {
await bridge.prepareAudioOutput()
} catch {
return // Ошибка устройства отображается в пульте; не запускать звук на другом выходе.
}
if (disposed) return
player = new MediaPlayer(
{ audio: audio.value!, video: video.value!, music: [musicA.value!, musicB.value!] },
(report) => bridge.report(report),
@@ -105,6 +113,7 @@ onMounted(async () => {
apply(await bridge.state())
})
onUnmounted(() => {
disposed = true
sceneAbort?.abort()
unsubscribe?.()
player?.destroy()