UNPKG

@livepeer/core-web

Version:

Livepeer UI Kit's core web library, for adding reactive stores to video elements.

39 lines (36 loc) 1.28 kB
import { VideoQuality } from '@livepeer/core/media'; import { ErrorData, HlsConfig } from 'hls.js'; declare const VIDEO_HLS_INITIALIZED_ATTRIBUTE = "data-livepeer-video-hls-initialized"; type HlsError = ErrorData; type VideoConfig = { autoplay?: boolean; }; type HlsVideoConfig = Partial<HlsConfig> & { autoPlay?: boolean; }; /** * Checks if hls.js can play in the browser. */ declare const isHlsSupported: () => boolean; /** * Create an hls.js instance and attach to the provided media element. */ declare const createNewHls: <TElement extends HTMLMediaElement>({ source, element, callbacks, aspectRatio, config, initialQuality, }: { source: string; element: TElement; initialQuality: VideoQuality; aspectRatio: number; callbacks: { onLive?: (v: boolean) => void; onPlaybackOffsetUpdated?: (d: number) => void; onDuration?: (v: number) => void; onCanPlay?: () => void; onError?: (data: HlsError) => void; onRedirect?: (url: string | null) => void; }; config: HlsVideoConfig; }) => { setQuality: (quality: VideoQuality) => void; destroy: () => void; }; export { type HlsError, type HlsVideoConfig, VIDEO_HLS_INITIALIZED_ATTRIBUTE, type VideoConfig, createNewHls, isHlsSupported };