feat: almost tried to use adapter but havent yet

This commit is contained in:
2026-04-23 01:25:45 +03:30
parent e0148573dc
commit 8278e313e5

View File

@@ -5,26 +5,32 @@
* creation: 21/4/2026
*/
import { NativeAdapter } from "../adapters";
import { AdapterAPI, PlayerConfig } from "../types/index";
export class VP {
private videoElement: HTMLElement | null;
private videoSources?: NodeListOf<HTMLSourceElement>;
private video: HTMLVideoElement | null;
private videoSrc?: NodeListOf<HTMLSourceElement>;
private config?: PlayerConfig;
private adapter?: AdapterAPI;
/**
* @param {string} video The targeted video element
* @param {PlayerConfig} config The config array
* @param video The targeted video element or id
* @param config The config array
*/
constructor(video: string | HTMLVideoElement, config: PlayerConfig) {
this.config = config;
if (video instanceof HTMLVideoElement) {
this.videoElement = video;
this.video = video;
} else {
this.videoElement = document.querySelector(video);
this.video = document.querySelector(video);
}
this.videoSources = this.videoElement?.querySelectorAll("source");
let adapter = this.config["type"];
if (!this.video) {
throw new Error(`Video element not found: ${video}`);
}
this.videoSrc = this.video?.querySelectorAll("source");
this.adapter = new NativeAdapter(this.video);
}
}