web: use video element and force live audio on

This commit is contained in:
every.channel 2026-02-24 23:05:35 -08:00
parent 66ce78e82d
commit 696e1aafb9
No known key found for this signature in database
2 changed files with 20 additions and 5 deletions

View file

@ -169,12 +169,27 @@ function mountPlayer(relayUrl, name) {
watch.connection.websocket = { enabled: false };
}
// A canvas enables video rendering. Without it, only audio is played.
const canvas = document.createElement("canvas");
canvas.className = "canvas";
watch.appendChild(canvas);
// Use a media element for live playback so browser audio controls/policies apply naturally.
const video = document.createElement("video");
video.className = "archiveVideo";
video.controls = true;
video.autoplay = true;
video.muted = false;
video.playsInline = true;
watch.appendChild(video);
mount.appendChild(watch);
const forceAudioOn = () => {
try {
watch.backend?.audio?.muted?.set?.(false);
watch.backend?.audio?.volume?.set?.(1);
} catch (_) {
// Best effort only.
}
};
forceAudioOn();
window.setTimeout(forceAudioOn, 1000);
window.setTimeout(forceAudioOn, 4000);
bindPlayerSignals(watch, name);
}