ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
51 lines (50 loc) • 1.78 kB
TypeScript
export interface HlsLikeStatic<TPlayer> {
Events: {
MANIFEST_LOADED: string;
ERROR: string;
};
isSupported: () => boolean;
new (): TPlayer;
}
export interface HlsPlayerLike {
startLoad(): () => void;
off: (eventName: string, handler: Function) => void;
on: (eventName: string, handler: Function) => void;
loadSource: (src: string) => void;
attachMedia: (video: HTMLVideoElement) => void;
destroy: () => void;
}
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;
}
export declare function bindMediaEvents(video: HTMLVideoElement, handlers: PlayerMediaHandlers): void;
export declare function unbindMediaEvents(video: HTMLVideoElement, handlers: PlayerMediaHandlers): void;
export declare function loadVideoSource<TPlayer extends HlsPlayerLike>(input: {
video: HTMLVideoElement;
src: string;
Hls?: HlsLikeStatic<TPlayer>;
existingHls?: TPlayer;
onManifestLoaded: Function;
onHlsError: Function;
}): TPlayer | undefined;