fix: focus mode uses go2rtc WebRTC iframe player (HLS not supported in FF)

This commit is contained in:
Claus Lohmar 2026-08-05 12:47:52 +01:00
parent 0104302367
commit 31cc243830

View file

@ -106,10 +106,23 @@ function updateFocus() {
const cam = cameras[focusIdx];
document.getElementById('focus-title').textContent = cam.name;
document.getElementById('focus-time').textContent = new Date().toLocaleTimeString() + ' live';
// go2rtc MSE stream for full-quality playback.
// go2rtc WebRTC player — works in all browsers.
const vid = document.getElementById('focus-video');
vid.src = `http://${location.hostname}:1984/api/stream.m3u8?src=${cam.id}_main`;
vid.play().catch(() => {});
const streamURL = `http://${location.hostname}:1984/stream.html?src=${cam.id}_main&mode=webrtc`;
// Use iframe for proper WebRTC support.
const container = vid.parentElement;
// Replace video element with iframe for go2rtc's player.
let iframe = container.querySelector('iframe.go2rtc-player');
if (!iframe) {
iframe = document.createElement('iframe');
iframe.className = 'go2rtc-player';
iframe.allow = 'autoplay; camera; microphone';
iframe.style.cssText = 'width:100%;height:100%;border:none;position:absolute;inset:0';
vid.style.display = 'none';
container.appendChild(iframe);
}
iframe.src = streamURL;
}
function renderThumbs() {
const strip = document.getElementById('focus-thumbs');