import type { ChannelSortField, Nullable, SortDirection } from "./shared.js"; /** * Browser-related configuration controlling Chrome launch behavior. Viewport dimensions are derived from the quality preset via getViewport() and are not stored in * this configuration object. */ export interface BrowserConfig { executablePath: Nullable; initTimeout: number; } /** * Filesystem paths for Chrome profile data and extension files. */ export interface PathsConfig { chromeDataDir: Nullable; chromeProfileName: string; extensionDirName: string; logFile: Nullable; } /** * Playback monitoring and recovery timing configuration. These values control how quickly the system detects playback problems and how aggressively it attempts * recovery. The defaults balance responsiveness against false positives from temporary buffering. */ export interface PlaybackConfig { bufferingGracePeriod: number; channelSelectorDelay: number; channelSwitchDelay: number; clickToPlayDelay: number; iframeInitDelay: number; maxPageReloads: number; monitorInterval: number; pageReloadWindow: number; sourceReloadDelay: number; stallCountThreshold: number; stallThreshold: number; sustainedPlaybackRequired: number; } /** * Recovery behavior configuration controlling retry logic, backoff timing, and circuit breaker thresholds. These settings determine how the system handles * failures and prevents runaway resource consumption from broken streams. */ export interface RecoveryConfig { backoffJitter: number; circuitBreakerThreshold: number; circuitBreakerWindow: number; maxBackoffDelay: number; stalePageCleanupInterval: number; stalePageGracePeriod: number; } /** * HLS streaming configuration controlling segment generation and lifecycle. */ export interface HLSConfig { idleTimeout: number; maxSegments: number; segmentDuration: number; } /** * Channels configuration controlling which predefined channels are enabled. */ export interface ChannelsConfig { channelSortDirection: SortDirection; channelSortField: ChannelSortField; disabledPredefined: string[]; enabledProviders: string[]; precacheProviders: string[]; visibleColumns: string[]; } /** * HDHomeRun emulation configuration. When enabled, PrismCast runs a separate HTTP server that emulates the HDHomeRun API, allowing Plex to discover and use * PrismCast as a virtual tuner for live TV and DVR recording. The emulated device appears in Plex's tuner setup and serves PrismCast's HLS streams directly. */ export interface HdhrConfig { deviceId: string; enabled: boolean; friendlyName: string; port: number; } /** * Logging configuration controlling file-based logging behavior. */ export interface LoggingConfig { debugFilter: string; httpLogLevel: "all" | "errors" | "filtered" | "none"; maxSize: number; } /** * HTTP server configuration controlling network binding. */ export interface ServerConfig { host: string; port: number; } /** * Capture mode for media recording. Determines how video/audio is captured from the browser and processed for HLS output. * - "ffmpeg": Captures WebM (H264+Opus) and uses FFmpeg to transcode audio to AAC. More stable for long recordings. * - "native": Captures fMP4 (H264+AAC) directly from Chrome. No dependencies but may be unstable with long recordings. */ export type CaptureMode = "ffmpeg" | "native"; /** * Media streaming configuration controlling video capture quality, timeouts, and concurrency limits. */ export interface StreamingConfig { audioBitsPerSecond: number; captureMode: CaptureMode; frameRate: number; maxConcurrentStreams: number; maxNavigationRetries: number; navigationTimeout: number; qualityPreset: string; videoBitsPerSecond: number; videoTimeout: number; } /** * Root configuration object containing all application settings organized by functional area. */ export interface Config { browser: BrowserConfig; channels: ChannelsConfig; hdhr: HdhrConfig; hls: HLSConfig; logging: LoggingConfig; paths: PathsConfig; playback: PlaybackConfig; recovery: RecoveryConfig; server: ServerConfig; streaming: StreamingConfig; }