Устранение гонки запуска live-камеры

This commit is contained in:
DCCONSTRUCTIONS
2026-08-23 12:47:54 +03:00
parent 4e00e804f3
commit 687c050c28
2 changed files with 24 additions and 2 deletions
@@ -470,8 +470,6 @@ export function MseFmp4WebSocketPlayer({
: "Подключение к локальному видеопотоку");
const mediaSource = new MediaSource();
objectUrl = URL.createObjectURL(mediaSource);
video.src = objectUrl;
startupWatchdog?.armFirstMedia();
const onSourceOpen = () => {
if (!transportIsCurrent() || failed) return;
@@ -562,7 +560,12 @@ export function MseFmp4WebSocketPlayer({
});
};
// Register before assigning the object URL. `video.src` is the action that
// lets the browser open this MediaSource; a fast sequential MSE lease must
// not fire `sourceopen` in the gap before its only listener exists.
mediaSource.addEventListener("sourceopen", onSourceOpen, { once: true });
startupWatchdog?.armFirstMedia();
video.src = objectUrl;
const disposeTransport = () => {
if (disposed) return;