/** * video-playback.ts — Video playback audit module for audit_video_playback tool. * Pure classifier + Playwright-backed page observer. * No new npm dependencies required. */ import { CaptureUnavailableError } from "./capture.js"; export { CaptureUnavailableError }; export type VideoObservation = { selector: string; hasSource: boolean; readyState: number; networkState: number; errorCode: number; paused: boolean; autoplayBlocked: boolean; currentTimeStart: number; currentTimeEnd: number; }; export type VideoClassification = { selector: string; state: "playing" | "paused" | "stalled" | "empty" | "error"; reason: string; advanced: boolean; }; export type VideoRow = VideoClassification & { readyState: number; errorCode: number; paused: boolean; currentTimeStart: number; currentTimeEnd: number; }; export type VideoPlaybackResult = { url: string | null; total_videos: number; rows: VideoRow[]; playing_count: number; not_playing_count: number; not_playing: VideoRow[]; summary: string; }; /** * Classify a single VideoObservation into a state+reason pair. * First-match-wins order per SPEC: * 1. error — errorCode > 0 * 2. empty — hasSource === false OR networkState === 3 * 3. playing — currentTimeEnd - currentTimeStart > 1e-3 AND paused === false * 4. paused — readyState >= 3 AND not advancing * 5. stalled — fallthrough */ export declare function classifyVideoPlayback(obs: VideoObservation): VideoClassification; export declare function auditVideoPlaybackSnapshot(observations: VideoObservation[], url?: string | null): VideoPlaybackResult; /** * Render a URL in headless Chromium, locate every