Устранение гонки запуска live-камеры
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { after, before, test } from "node:test";
|
||||
|
||||
import { createElement } from "react";
|
||||
@@ -184,6 +185,24 @@ test("floating observation interaction captures resize and movable header pointe
|
||||
);
|
||||
});
|
||||
|
||||
test("live camera registers sourceopen before assigning the MSE object URL", async () => {
|
||||
const source = await readFile(
|
||||
new URL("../src/components/MseFmp4WebSocketPlayer.tsx", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
const listenerIndex = source.indexOf(
|
||||
'mediaSource.addEventListener("sourceopen", onSourceOpen, { once: true });',
|
||||
);
|
||||
const sourceAssignmentIndex = source.indexOf("video.src = objectUrl;");
|
||||
|
||||
assert.ok(listenerIndex >= 0, "sourceopen listener must remain explicit");
|
||||
assert.ok(sourceAssignmentIndex >= 0, "MediaSource object URL assignment must remain explicit");
|
||||
assert.ok(
|
||||
listenerIndex < sourceAssignmentIndex,
|
||||
"sourceopen listener must exist before video.src can open the MediaSource",
|
||||
);
|
||||
});
|
||||
|
||||
test("recorded observation timeline clamps relative seek time without epoch precision in the UI", () => {
|
||||
const range = normalizeTimelineRange({
|
||||
min: 0,
|
||||
|
||||
Reference in New Issue
Block a user