UNPKG

ranui

Version:

A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.

49 lines (48 loc) 2.02 kB
import type { EngineAdapter, EngineFormat, EngineQualityLevel } from './adapters/types'; export interface PlayerMediaHandlers { onCanplay: (e: Event) => void; onCanplaythrough: (e: Event) => void; onComplete: (e: Event) => void; onDurationchange: (e: Event) => void; onEmptied: (e: Event) => void; onEnded: (e: Event) => void; onError: (e: Event) => void; onLoadeddata: (e: Event) => void; onLoadedmetadata: (e: Event) => void; onLoadstart: (e: Event) => void; onPause: (e: Event) => void; onPlay: (e: Event) => void; onPlaying: (e: Event) => void; onProgress: (e: Event) => void; onRatechange: (e: Event) => void; onSeeked: (e: Event) => void; onSeeking: (e: Event) => void; onStalled: (e: Event) => void; onSuspend: (e: Event) => void; onTimeupdate: (e: Event) => void; onVolumechange: (e: Event) => void; onWaiting: (e: Event) => void; onEnterPictureInPicture: (e: Event) => void; onLeavePictureInPicture: (e: Event) => void; } export declare function bindMediaEvents(video: HTMLVideoElement, handlers: PlayerMediaHandlers): void; export declare function unbindMediaEvents(video: HTMLVideoElement, handlers: PlayerMediaHandlers): void; export interface LoadVideoSourceInput { video: HTMLVideoElement; src: string; /** The player's `format` attribute value — passed straight through as `detectFormat`'s typeHint. */ format?: string; existingEngine?: EngineAdapter; onLevelsReady: (levels: EngineQualityLevel[]) => void; onEngineError: (payload: { fatal: boolean; detail: unknown; }) => void; /** * Injectable for tests — defaults to the real registry, mirroring how `Hls` * was already an injected param rather than a `window.Hls` read inside this * function. */ createEngineAdapter?: (format: EngineFormat) => EngineAdapter | undefined; } export declare function loadVideoSource(input: LoadVideoSourceInput): EngineAdapter | undefined;