chore(types): scattered the type interfaces

scattered type interfaces wih goal of scalability and easier debug and coding
This commit is contained in:
2026-04-28 01:16:02 +03:30
parent 918972e101
commit 7e21808d69
4 changed files with 86 additions and 63 deletions

View File

@@ -1,65 +1,11 @@
/**
* type interfaces
*
* author: db123 at db
* creation: 22/4/2026
*/
export { AdapterAPI } from './AdapterAPI';
export interface AdapterAPI {
load: () => void;
play: () => void;
pause: () => void;
destroy: () => void;
time: number;
volume: number;
muted: boolean;
readonly duration: () => number;
}
export {
PlayerConfig,
ControlConfig,
AdapterConfig,
HLSOptions,
DASHOptions,
} from './PlayerOptions';
export interface PlayerConfig {
type: "native" | "hls" | "dash";
theme?: "dark" | "light";
accent?: string;
controls?: boolean | ControlConfig;
preload?: "auto" | "metadata" | "none";
autoplay?: boolean;
loop?: boolean;
muted?: boolean;
adapters?: AdapterConfig;
prefixClass: string;
}
export interface ControlConfig {
playToggle: boolean;
seekPos: number;
seekNeg: number;
qualitySelector: boolean;
playbackSpeed: Array<number>;
fullscreen: boolean;
volume: boolean;
progressBar: boolean;
currentTime: boolean;
timeLeft: boolean;
}
export interface AdapterConfig {
native?: boolean;
hls?: boolean | HLSOptions;
dash?: boolean | DASHOptions;
}
export interface HLSOptions {
enableWorker?: boolean;
}
export interface DASHOptions {
enableWorker?: boolean;
}
export interface PlayerEvents {
onPlay?: () => void;
onPause?: () => void;
onEnd?: () => void;
onError?: () => void;
onBuffer?: () => void;
}
export { PlayerEvents } from './PlaybackState';