MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / collectMotionFrames

Function collectMotionFrames

packages/cli/src/commands/layout.ts:368–392  ·  view source on GitHub ↗
(
  page: import("puppeteer-core").Page,
  times: number[],
  selectors: string[],
  livenessScopes: string[],
)

Source from the content-addressed store, hash-verified

366}
367
368async function collectMotionFrames(
369 page: import("puppeteer-core").Page,
370 times: number[],
371 selectors: string[],
372 livenessScopes: string[],
373): Promise<MotionFrame[]> {
374 const frames: MotionFrame[] = [];
375 for (const time of times) {
376 await seekTo(page, time);
377 const sample = await page.evaluate(
378 (options: { selectors: string[]; livenessScopes: string[] }) => {
379 const win = window as unknown as {
380 __hyperframesMotionSample?: (o: { selectors: string[]; livenessScopes: string[] }) => {
381 data: MotionFrame["data"];
382 liveness: Record<string, string>;
383 };
384 };
385 return win.__hyperframesMotionSample?.(options) ?? { data: {}, liveness: {} };
386 },
387 { selectors, livenessScopes },
388 );
389 frames.push({ time, data: sample.data, liveness: sample.liveness });
390 }
391 return frames;
392}
393
394/**
395 * Motion verification (#1437): sample the asserted selectors on a dense grid

Callers 1

runMotionPassFunction · 0.85

Calls 2

evaluateMethod · 0.80
seekToFunction · 0.70

Tested by

no test coverage detected