/** * CDP-based ScreencastStream implementation. * * This provides a unified screencast implementation that works with any * CDP session provider (Playwright, Puppeteer, direct CDP, etc.). */ import { EventEmitter } from 'node:events'; import type { CdpSessionProvider, ScreencastOptions } from './types.js'; /** * ScreencastStream wraps CDP screencast with an event emitter interface. * * Works with any CDP session provider (Playwright, Puppeteer, direct CDP). * * @example * ```typescript * const stream = new ScreencastStream(cdpProvider, { quality: 80 }); * stream.on('frame', (frame) => { * console.log(`Frame: ${frame.viewport.width}x${frame.viewport.height}`); * }); * await stream.start(); * // Later... * await stream.stop(); * ``` */ export declare class ScreencastStream extends EventEmitter { /** Whether screencast is currently active */ private active; /** Resolved options with defaults applied (excludes threadId which is only used for page selection) */ private options; /** CDP session provider */ private provider; /** Current CDP session */ private cdpSession; /** Frame handler reference (for cleanup) */ private frameHandler; /** * Creates a new ScreencastStream. * * @param provider - CDP session provider (browser instance) * @param options - Screencast configuration options */ constructor(provider: CdpSessionProvider, options?: ScreencastOptions); /** * Start the screencast. * If already active, returns immediately. */ start(): Promise; /** * Acknowledge a frame to CDP (required to continue receiving frames). */ private acknowledgeFrame; /** * Stop the screencast and release resources. * Safe to call even if browser/CDP session is already closed. */ stop(): Promise; /** * Check if screencast is currently active. */ isActive(): boolean; /** * Emit a URL update event. * Browser providers call this when navigation is detected. */ emitUrl(url: string): void; /** * Reconnect the screencast by stopping and restarting. * Use this when the active page/tab changes. * * @returns Promise that resolves when reconnection is complete * @throws Error if reconnection fails (also emits 'error' event) */ reconnect(): Promise; } //# sourceMappingURL=screencast-stream.d.ts.map