import type { Nullable } from "./shared.js"; import type { Page } from "puppeteer-core"; import type { RecoveryMetrics } from "../streaming/recovery.js"; /** * Information about an active streaming session. Created when a stream request is received and deleted when the stream ends. */ export interface StreamInfo { channelName: Nullable; id: number; page: Page; startTime: Date; stopMonitor: Nullable<() => RecoveryMetrics>; url: string; } /** * Snapshot of a video element's playback state. Collected by the playback health monitor to detect stalls, errors, and other problems. */ export interface VideoState { currentTime: number; ended: boolean; error: boolean; muted: boolean; networkState: number; paused: boolean; readyState: number; time: number; volume: number; } /** * Strategy for selecting a video element when multiple are present. "selectFirstVideo" takes the first video in DOM order; "selectReadyVideo" finds the video * with readyState >= 3, which typically identifies the actively playing main content rather than preloaded ads. */ export type VideoSelectorType = "selectFirstVideo" | "selectReadyVideo"; /** * Result of URL validation indicating whether the URL is safe to navigate to. */ export interface UrlValidationResult { reason?: string; valid: boolean; } /** * Alias for UrlValidationResult maintained for backward compatibility with existing code. */ export type UrlValidation = UrlValidationResult; /** * Health check response structure returned by the /health endpoint. */ export interface HealthStatus { browser: { connected: boolean; pageCount: number; }; captureMode: string; chrome: Nullable; clients: { byType: { count: number; type: string; }[]; total: number; }; ffmpegAvailable: boolean; memory: { heapTotal: number; heapUsed: number; rss: number; segmentBuffers: number; }; message?: string; status: "degraded" | "healthy" | "unhealthy"; streams: { active: number; limit: number; }; timestamp: string; uptime: number; version: string; } /** * Information about a single active stream as returned by the /streams endpoint. */ export interface StreamListItem { channel: Nullable; duration: number; id: number; startTime: string; url: string; } /** * Response structure for the /streams endpoint. */ export interface StreamListResponse { count: number; limit: number; streams: StreamListItem[]; }