import { type Player, type PlayerPlugin, type RequiredPartial, type Source } from '@oplayer/core'; import type Hls from 'hls.js'; import type { ErrorData, HlsConfig, Level, MediaPlaylist } from 'hls.js'; export type Matcher = (video: HTMLVideoElement, source: Source, forceHLS: boolean) => boolean; export interface HlsPluginOptions { library?: string; matcher?: Matcher; /** * default auto */ defaultQuality?: (levels: Level[]) => number; /** * default browser language */ defaultAudio?: (tracks: MediaPlaylist[]) => number; /** * default browser language */ defaultSubtitle?: (tracks: MediaPlaylist[]) => number; /** * custom handle hls fatal error */ errorHandler?: (player: Player, data: ErrorData) => void; /** * config for hls.js * * @type {Partial} */ config?: Partial; /** * force use hls.js * @type {boolean} false */ forceHLS?: boolean; /** * enable quality control for the HLS stream, does not apply to the native (iPhone) clients. * default: true */ qualityControl?: boolean; /** * control how the stream quality is switched. default: immediate * @value immediate: Trigger an immediate quality level switch to new quality level. This will abort the current fragment request if any, flush the whole buffer, and fetch fragment matching with current position and requested quality level. * @value smooth: Trigger a quality level switch for next fragment. This could eventually flush already buffered next fragment. */ qualitySwitch?: 'immediate' | 'smooth'; /** * @default: false */ withBitrate?: boolean; /** * @default: true */ audioControl?: boolean; /** * @default: true */ textControl?: boolean; } declare class HlsPlugin implements PlayerPlugin { key: string; name: string; version: string; static library: typeof import('hls.js/dist/hls.min.js'); player: Player; instance?: Hls; options: RequiredPartial; constructor(options?: HlsPluginOptions); apply(player: Player): this; load({ $video }: Player, source: Source): Promise; unload(): void; destroy(): void; } export default function create(options?: HlsPluginOptions): HlsPlugin; export {}; //# sourceMappingURL=index.d.ts.map