Files
mqtt-ingest/app/public/index.html
2026-07-04 18:57:41 +05:00

47 lines
1.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>edge5 video relay</title>
<script src="https://cdn.jsdelivr.net/npm/mpegts.js/dist/mpegts.js"></script>
<style>
body { margin: 0; background: #000; }
#v { display: block; width: 100vw; height: 100vh; object-fit: contain; }
</style>
</head>
<body>
<video id="v" controls autoplay muted></video>
<script>
const cameraId = new URLSearchParams(location.search).get('camera') ?? 'v1';
const wsUrl = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.host}/ws/${cameraId}`;
const player = mpegts.createPlayer(
{ type: 'mpegts', isLive: true, url: wsUrl, hasAudio: false },
{
enableWorker: true, // transmuxing в отдельном треде
enableStashBuffer: false, // без IO-stash для real-time
autoCleanupSourceBuffer: true, // не копить старые буферы в MSE
autoCleanupMaxBackwardDuration: 10,
autoCleanupMinBackwardDuration: 5,
// liveSync — плавное догоняние через playbackRate, а не жёсткий seek
liveSync: true,
liveSyncMaxLatency: 3.0, // при плохом интернете даём 3с
liveSyncTargetLatency: 1.5, // target после выравнивания
liveSyncPlaybackRate: 1.2, // ускорение не более 1.2x
// liveBufferLatencyChasing оставляем, но увеличиваем окно
liveBufferLatencyChasing: true,
liveBufferLatencyMaxLatency: 3.0,
liveBufferLatencyMinRemain: 0.5,
lazyLoad: false,
deferLoadAfterSourceOpen: false,
}
);
player.attachMediaElement(document.getElementById('v'))
player.load()
player.play()
</script>
</body>
</html>