import { Observable, Subject } from 'rxjs'; import { Video, VideoLoadOptions } from './model'; import { BaseVideoLoader } from './video-loader'; import Hls, { AudioTracksUpdatedData, AudioTrackSwitchingData, Events as HlsEvents, HlsConfig, MediaKeySessionContext, MediaPlaylist } from 'hls.js'; import { OmpAudioTrack, OmpAudioTrackCreateType, OmpNamedEventEventName } from '../types'; import { VideoControllerApi } from './video-controller-api'; import { AudioGroup } from '../m3u8/m3u8.model'; import { M3u8File } from '../m3u8/m3u8-file'; export type HlsLicenseXhrSetupFn = (xhr: XMLHttpRequest, url: string, keyContext: MediaKeySessionContext, licenseChallenge: Uint8Array) => void | Uint8Array | Promise; export interface OmpHlsConfig extends HlsConfig { /** * Should fetch hls.js embedded subtitles */ fetchManifestSubtitleTracks: boolean; /** * Should display hls.js subtitles */ subtitleDisplay: boolean; /** * Function that creates hls.js pre-processor function {@link HlsConfig.licenseXhrSetup} for modifying license requests (https://github.com/video-dev/hls.js/blob/master/docs/API.md#licensexhrsetup) * If set, created function takes precedence over {@link licenseXhrSetup} * * @param sourceUrl * @param options */ loadVideoLicenseXhrSetup?: (sourceUrl: string, options?: VideoLoadOptions | undefined) => HlsLicenseXhrSetupFn; } type OmpHlsEventListener = (event: any, data: any) => void; export interface OmpHlsAudioTrackPackage { audioTrackName: string; audioGroup: AudioGroup; m3u8File: M3u8File; } export declare class VideoHlsLoader extends BaseVideoLoader { _eventMapping: Map; protected _hlsConfig: Partial; protected _hls: Hls | undefined; protected _hlsEventListenersMap: Map; protected _onHlsAudioTracksUpdated$: Subject; protected _onHlsAudioTrackSwitched$: Subject; protected _videoEventBreaker$: Subject; constructor(videoController: VideoControllerApi); loadVideo(sourceUrl: string, options?: VideoLoadOptions | undefined): Observable