🐛 Use native media state during rapid slice navigation
This commit is contained in:
parent
a341def261
commit
e4969acced
@ -25,3 +25,16 @@ Run `BROWSER_PATH='/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edg
|
||||
## Limits
|
||||
|
||||
No production verification or deployment. No promise of retaining speed across page reloads. Broad release/capacity checks are not claimed by this local UI fix. The original task-gate report remains failed for its environment issue; the targeted follow-up above supplies the successful missing check.
|
||||
|
||||
## Follow-up: shortcut navigation playback (base a341def2)
|
||||
|
||||
- Built a real-browser keyboard loop (Ctrl+Arrow then immediate Space) using synthetic source-index media. Reproduced repeated failures with all bytes buffered: UI either remained in positioning or reverted to paused. Temporary probes and event traces are under `local-data/test-results/acceptance-shortcut-playback/`.
|
||||
- Compared the pinned vendor implementation and native video properties: Movi derives seeking/readiness from its asynchronous state machine and paused from play intent. These diverge from the underlying media during rapid navigation; stale pause notifications could cancel a new play. The adapter now uses the current native engine's real paused/seeking/readyState; the software path retains vendor getters. No change to logical annotation times or seek accuracy.
|
||||
- Extended the permanent browser regression to native clips, source-index clips with integer offsets, and source-index clips with fractional offsets. Each performs 15 transitions, checks both real media clocks advance after immediate keyboard play, and retains the playback rate. Passed twice with the fix (45 transitions per run). Screenshots/report: `local-data/test-results/shortcut-playback-fixed/`; task-run copy: `local-data/test-results/acceptance-playback-rate/`.
|
||||
- Ran that same strengthened regression against the pre-fix MoviVideo from a341def2: failed waiting for playback after the shortcut (`local-data/test-results/shortcut-playback-baseline/browser-red.log`). Restored the fix automatically afterward.
|
||||
- Task verification `verify-1793893323697578000/report.json`: type/architecture, format, and browser checks passed. Full frontend gate failed with one additional-to-known-baseline ID: `fanyu-comment-followup.test.mjs :: dashboard routes all workforce roles to the clean production quality panel`. Running the required gate with the pre-fix MoviVideo produces the same failure (`shortcut-playback-baseline/frontend-gate.log`); the tested dashboard sources are unchanged by this task. Known-failures was not expanded and the failed report remains failed.
|
||||
- Actual acceptance screenshot checked with both cameras and 1.5x rate; no copy/layout changes. Production/client-specific verification remains pending; this is a local reproduction of the reported symptom, not proof of every customer's failure condition.
|
||||
|
||||
- Media recovery across annotation, quality review and acceptance passed with forced software-engine reload, simulated failed loading, bounded retry, retained position, and annotation draft preservation: `REWORK_BOUNDARY_BROWSER_TEST=1 ANNOTATION_FEEDBACK_BROWSER_SCRIPT=local-data/test-results/acceptance-shortcut-playback/media-recovery.mjs go test -count=1 ./internal/api -run '^TestReworkBoundaryBrowserReplica$' -v` (35.16s). The original script failed before mounting due to a hardcoded missing `.vite/deps/react-dom_client.js`; the task-local copy changes only its Vite cache directory and React module import through a Vite-transformed module. No product/fixture assertions were removed. The original harness failure remains recorded, and no shared node_modules cache was repaired or overwritten.
|
||||
|
||||
Local only. No push, PR, deployment, production data change or source-media change. Remaining release limitation: the pre-existing dashboard frontend assertion is still outside the known-failure baseline and blocks claiming the full task gate green.
|
||||
|
||||
@ -6,3 +6,11 @@ Base: origin/dev @ 867d406c (contains live 6eee426e)
|
||||
Scope: FinalAcceptanceWorkspace playback state, optional workbench rate ownership, isolated browser regression.
|
||||
Out of scope: Persistence across browser reloads, global player defaults, task/permission changes, V4 migration, production writes or deployment.
|
||||
Risk: Shared workbench must preserve its existing uncontrolled behavior for annotation and quality review; remounted acceptance media must receive the retained rate before playback.
|
||||
|
||||
## Follow-up: intermittent shortcut navigation playback
|
||||
|
||||
Follow-up base: `a341def2`. The user reports occasional inability to play after keyboard slice navigation. Reproduced locally with synthetic full-source clips and Ctrl+Arrow navigation followed immediately by Space; no production mutation.
|
||||
|
||||
Scope: normalize Movi's HTMLMediaElement-shaped paused/seeking/readyState properties from its current native engine when present; preserve the existing software-engine getters, source/seek coordinates, media bytes, annotations and permissions. Restore original property descriptors on cleanup. Extend the browser regression to repeated keyboard navigation with integer and fractional source offsets.
|
||||
|
||||
Compatibility: pinned vendored Movi 0.4.1 exposes the active native video via getHLSVideoElement(), including its direct native wrapper; the software engine returns null. Re-check that seam if the vendor is upgraded. No vendor bundle or network settings changed.
|
||||
|
||||
@ -191,9 +191,30 @@ export const MoviVideo = React.forwardRef<HTMLVideoElement, MoviVideoProps>(func
|
||||
// without modifying the vendor's private state or remounting the editor.
|
||||
const originalOwnError = Object.getOwnPropertyDescriptor(element, "error");
|
||||
const mediaPrototype = Object.getPrototypeOf(element);
|
||||
const nativeProperties = ["paused", "seeking", "readyState"] as const;
|
||||
const originalNativeProperties = nativeProperties.map(
|
||||
(name) => [name, Object.getOwnPropertyDescriptor(element, name)] as const,
|
||||
);
|
||||
let currentMediaError: unknown = null;
|
||||
if (mode === "movi") {
|
||||
Object.defineProperty(element, "error", { configurable: true, get: () => currentMediaError });
|
||||
// Movi's state/intent flags can lag the native video during rapid seeks.
|
||||
// In particular, an old pause notification can cancel a newer play, and
|
||||
// "seeking" reports HAVE_CURRENT_DATA before the native target is ready.
|
||||
// Use the active native engine's media state; WASM keeps its own getters.
|
||||
for (const name of nativeProperties) {
|
||||
Object.defineProperty(element, name, {
|
||||
configurable: true,
|
||||
get() {
|
||||
const native = (
|
||||
element as HTMLElement & {
|
||||
player?: { getHLSVideoElement?: () => HTMLVideoElement | null };
|
||||
}
|
||||
).player?.getHLSVideoElement?.();
|
||||
return native ? native[name] : Reflect.get(mediaPrototype, name, element);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
const add = (name: string, listener: EventListener) => {
|
||||
element.addEventListener(name, listener);
|
||||
@ -328,6 +349,10 @@ export const MoviVideo = React.forwardRef<HTMLVideoElement, MoviVideoProps>(func
|
||||
if (mode === "movi") {
|
||||
if (originalOwnError) Object.defineProperty(element, "error", originalOwnError);
|
||||
else Reflect.deleteProperty(element, "error");
|
||||
for (const [name, descriptor] of originalNativeProperties) {
|
||||
if (descriptor) Object.defineProperty(element, name, descriptor);
|
||||
else Reflect.deleteProperty(element, name);
|
||||
}
|
||||
}
|
||||
};
|
||||
}, [mode, plainSrc, endAt]);
|
||||
|
||||
@ -36,7 +36,7 @@ execFileSync("ffmpeg", [
|
||||
"-f",
|
||||
"lavfi",
|
||||
"-i",
|
||||
"testsrc2=s=320x240:r=30:d=24",
|
||||
"testsrc2=s=320x240:r=30:d=25",
|
||||
"-c:v",
|
||||
"libx264",
|
||||
"-pix_fmt",
|
||||
@ -53,8 +53,9 @@ const browser = await chromium.launch({
|
||||
});
|
||||
const cases = [];
|
||||
try {
|
||||
for (const engine of ["native", "movi"]) {
|
||||
const sourceIndex = engine === "movi";
|
||||
for (const engine of ["native", "movi", "movi-fractional"]) {
|
||||
const sourceIndex = engine !== "native";
|
||||
const fractionalOffset = engine === "movi-fractional" ? 0.023333333 : 0;
|
||||
const context = await browser.newContext({ viewport: { width: 1500, height: 1000 } });
|
||||
const page = await context.newPage();
|
||||
const errors = [];
|
||||
@ -119,7 +120,7 @@ try {
|
||||
...(sourceIndex
|
||||
? {
|
||||
sourceIndexSchema: "droboticflow.source-slice-index/v1",
|
||||
sourceMediaOffsets: { left: index * 8, right: index * 8 },
|
||||
sourceMediaOffsets: { left: index * 8 + fractionalOffset, right: index * 8 + fractionalOffset },
|
||||
rightBoundarySeconds: Array.from({ length: 241 }, (_, i) => i / 30),
|
||||
}
|
||||
: {}),
|
||||
@ -168,10 +169,12 @@ try {
|
||||
);
|
||||
await assertRate(2);
|
||||
await page.getByRole("button", { name: "播放", exact: true }).click();
|
||||
await page.waitForFunction(() =>
|
||||
[...document.querySelectorAll("[data-camera]")].some(
|
||||
(p) => ["VIDEO", "MOVI-PLAYER"].includes(p.tagName) && !p.paused && p.currentTime > 0.2,
|
||||
),
|
||||
await page.waitForFunction(
|
||||
(offset) =>
|
||||
[...document.querySelectorAll("[data-camera]")].some(
|
||||
(p) => ["VIDEO", "MOVI-PLAYER"].includes(p.tagName) && !p.paused && p.currentTime > offset + 0.3,
|
||||
),
|
||||
sourceIndex ? 8 + fractionalOffset : 0,
|
||||
);
|
||||
await page.getByRole("button", { name: "暂停", exact: true }).click();
|
||||
await assertRate(2);
|
||||
@ -186,9 +189,38 @@ try {
|
||||
() => document.querySelector('[data-testid="review-current-slice"]')?.textContent === "第二片",
|
||||
);
|
||||
await assertRate(1.5);
|
||||
// Actual keyboard events, immediately followed by play: do not wait for
|
||||
// canplay/seeked first. Older Movi state flags could strand this sequence
|
||||
// in positioning, or let an old pause event cancel the new play request.
|
||||
const shortcutChanges = 12;
|
||||
for (let iteration = 0; iteration < shortcutChanges; iteration++) {
|
||||
const forward = iteration % 2 === 0;
|
||||
await page.getByTestId("final-acceptance-workspace").focus();
|
||||
await page.keyboard.press(forward ? "Control+ArrowRight" : "Control+ArrowLeft");
|
||||
await page.waitForFunction(
|
||||
(name) => document.querySelector('[data-testid="review-current-slice"]')?.textContent === name,
|
||||
forward ? "第三片" : "第二片",
|
||||
);
|
||||
await page.keyboard.press("Space");
|
||||
const offset = sourceIndex ? (forward ? 16 : 8) + fractionalOffset : 0;
|
||||
await page.waitForFunction(
|
||||
(offset) => {
|
||||
const players = [...document.querySelectorAll("[data-camera]")].filter((p) =>
|
||||
["VIDEO", "MOVI-PLAYER"].includes(p.tagName),
|
||||
);
|
||||
return (
|
||||
players.length === 2 &&
|
||||
players.every((p) => !p.paused && !p.seeking && p.readyState >= 2 && p.currentTime > offset + 0.35)
|
||||
);
|
||||
},
|
||||
offset,
|
||||
{ timeout: 8000 },
|
||||
);
|
||||
await page.keyboard.press("Space");
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
await page.screenshot({ path: `${out}/${engine}.png`, fullPage: true });
|
||||
cases.push({ engine, sliceChanges: 3, retainedRates: [2, 1.5, 1.5], errors });
|
||||
cases.push({ engine, sliceChanges: 3 + shortcutChanges, retainedRates: [2, 1.5, 1.5], errors });
|
||||
await context.close();
|
||||
}
|
||||
await fs.writeFile(`${out}/report.json`, JSON.stringify({ passed: true, cases }, null, 2));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user