@oplayer/plugins
Version:
oplayer's plugin
57 lines • 1.77 kB
TypeScript
import type { Player, Source, PlayerPlugin, PartialRequired } from '@oplayer/core';
import type { Highlight, SubtitleSource, Thumbnails, UIInterface } from '@oplayer/ui';
import './playlist.css';
interface Ctx {
ui: UIInterface;
danmaku?: any;
}
interface Segment {
uri: string;
timeline: number;
title: string;
}
export interface PlaylistOptions {
sources?: PlaylistSource[];
customFetcher?: (player: Player, source: PlaylistSource, index: number) => Promise<PlaylistSource> | PlaylistSource;
autoNext?: boolean;
autoHide?: boolean;
initialIndex?: number;
m3uList?: {
sourceFormat?: (info: Segment) => Source;
} | true;
}
export interface PlaylistSource extends Omit<Source, 'src'> {
src?: string;
id?: string | number;
duration?: string;
subtitles?: SubtitleSource[];
thumbnails?: Thumbnails;
highlights?: Highlight[];
danmaku?: string | Function | any[];
}
export default class PlaylistPlugin implements PlayerPlugin {
key: string;
name: string;
version: string;
static m3u8Parser: any;
player: Player<Ctx>;
currentIndex?: number;
$root: HTMLDivElement;
options: PartialRequired<PlaylistOptions, 'autoNext' | 'autoHide' | 'sources'>;
constructor(options?: PlaylistOptions);
apply(player: Player): this | undefined;
_init(): Promise<void>;
get isWaiting(): boolean;
changeSource(idx: number): Promise<void> | undefined;
changeSourceList(sources: PlaylistSource[]): void;
next(): void;
previous(): void;
showUI(): void;
hideUI(): void;
renderContainer(): void;
renderList(sources: PlaylistSource[]): void;
_updateHeader(): void;
destroy(): void;
}
export {};
//# sourceMappingURL=playlist.d.ts.map