UNPKG

@gibme/tablo.tv

Version:

API interface for interacting with a Tablo TV device

93 lines (92 loc) 3.41 kB
import { EventEmitter } from 'events'; import type { Tablo } from './tablo'; export default class LiveTranscoder extends EventEmitter { readonly id: string; private readonly device; private readonly channel_id; readonly output_path: string; readonly filename: string; readonly auto_restart: boolean; private static readonly instances; private readonly ffmpeg_path; private process?; private timer?; private emitter; /** * Creates a new live transcoder instance. * * The `output_path` must be a valid path to a directory on the local filesystem. * * The `channel_id` must be a valid channel ID for the specified `device`. * * The `device` must be a valid `Device` instance. * @param id * @param device * @param channel_id * @param output_path * @param filename * @param auto_restart */ protected constructor(id: string, device: Tablo, channel_id: string, output_path: string, filename?: string, auto_restart?: boolean); private _use_count; get use_count(): number; private _active; get active(): boolean; private set active(value); private _full_path; get full_path(): string; private set full_path(value); private _session?; get session(): Tablo.PlayerSession | undefined; private set session(value); get channel(): Tablo.Channel | undefined; get relative_path(): string; /** * Retrieves an existing instance of a live transcoder or creates a new instance if one does not exist. * * The `device` must be a valid `Device` instance. * * The `channel_id` must be a valid channel ID for the specified `device`. * * The `output_path` must be a valid path to a directory on the local filesystem. * * The `filename` is the name of the output file. * * @param device * @param channel_id * @param output_path * @param filename * @param auto_restart */ static instance(device: Tablo, channel_id: string, output_path: string, filename?: string, auto_restart?: boolean): Promise<LiveTranscoder>; on(event: 'error', listener: (error: Error) => void): this; on(event: 'exit', listener: (code: number | null) => void): this; on(event: 'ready', listener: () => void): this; on(event: 'stopped', listener: () => void): this; once(event: 'error', listener: (error: Error) => void): this; once(event: 'exit', listener: (code: number | null) => void): this; once(event: 'ready', listener: () => void): this; once(event: 'stopped', listener: () => void): this; off(event: 'error', listener: (error: Error) => void): this; off(event: 'exit', listener: (code: number | null) => void): this; off(event: 'ready', listener: () => void): this; off(event: 'stopped', listener: () => void): this; /** * Starts the live transcoder. * * The live transcoder will attempt to start a new session for the specified `channel_id` on the specified `device`. * * If a session is successfully started, the live transcoder will attempt to start a new transcoding process. */ start(): Promise<boolean>; /** * Stops the live transcoder. */ stop(): void; /** * Attempts to start the FFMpeg process * @private */ private start_ffmpeg; } export { LiveTranscoder };