feat: made more modular
This commit is contained in:
28
src/core/VideoPlayer.ts
Normal file
28
src/core/VideoPlayer.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* main player
|
||||||
|
*
|
||||||
|
* author: db123 at db
|
||||||
|
* creation: 21/4/2026
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { PlayerConfig, HLSOptions, DASHOptions } from "../types/index";
|
||||||
|
|
||||||
|
export class VP {
|
||||||
|
videoElement: HTMLElement | null;
|
||||||
|
videoSources?: NodeListOf<HTMLSourceElement>;
|
||||||
|
config?: PlayerConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} video The targeted video element
|
||||||
|
* @param {PlayerConfig} config The config array
|
||||||
|
*/
|
||||||
|
constructor(video: string, config: PlayerConfig) {
|
||||||
|
this.config = config;
|
||||||
|
this.videoElement = document.querySelector(video);
|
||||||
|
this.videoSources = this.videoElement?.querySelectorAll("source");
|
||||||
|
}
|
||||||
|
|
||||||
|
private adapters(): void {}
|
||||||
|
private ui(): void {}
|
||||||
|
private plugins(): void {}
|
||||||
|
}
|
||||||
1
src/core/index.ts
Normal file
1
src/core/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { VP } from "./VideoPlayer";
|
||||||
Reference in New Issue
Block a user