/** * Generic streaming infrastructure routes. * * Extracted from retake-routes.ts so any streaming destination (Retake.tv, * custom RTMP, etc.) can reuse the same pipeline: capture mode detection, * Xvfb management, browser capture, FFmpeg, frame routing, volume/mute. * * Platform-specific credential fetching lives in destination adapters * (e.g. retake-routes.ts exports `createRetakeDestination`). */ import type { IncomingMessage, ServerResponse } from "node:http"; import type { StreamConfig } from "../services/stream-manager"; import type { StreamRouteState } from "./stream-route-state"; import type { StreamingDestination } from "./streaming-types"; export type { StreamRouteState } from "./stream-route-state"; /** * A streaming destination provides RTMP credentials and optional lifecycle * hooks. Canonical definition lives in plugin-streaming-base; re-exported here * so existing consumers keep working. */ export type { OverlayLayoutData, StreamingDestination } from "./streaming-types"; /** Resolve the active streaming destination from the registry. */ export declare function getActiveDestination(state: StreamRouteState): StreamingDestination | undefined; /** * Detect the best capture mode for the current environment. * * Priority: * 1. STREAM_MODE / RETAKE_STREAM_MODE env var (explicit override) * 2. Electron -> "pipe" (capturePage -> POST /api/stream/frame -> FFmpeg stdin) * 3. Linux with DISPLAY or Xvfb -> "x11grab" (Hyperscape approach) * 4. macOS -> "avfoundation" (native screen capture) * 5. Fallback -> "file" (Puppeteer CDP -> temp JPEG -> FFmpeg) */ /** @internal Exported for testing. */ export declare function detectCaptureMode(): StreamConfig["inputMode"]; /** * Try to start Xvfb on the specified display if not already running (Linux only). * Returns true if display is available, false otherwise. */ /** @internal Exported for testing. */ export declare function ensureXvfb(display: string, resolution: string): Promise; /** Returns `true` if handled, `false` to fall through. */ export declare function handleStreamRoute(req: IncomingMessage, res: ServerResponse, pathname: string, method: string, state: StreamRouteState): Promise; export declare function onAgentMessage(text: string, state: StreamRouteState): Promise; //# sourceMappingURL=stream-routes.d.ts.map