diff --git a/src/core/VideoPlayer.ts b/src/core/VideoPlayer.ts index 85d6ce8..68c7a70 100644 --- a/src/core/VideoPlayer.ts +++ b/src/core/VideoPlayer.ts @@ -5,7 +5,7 @@ * creation: 21/4/2026 */ -import { PlayerConfig, HLSOptions, DASHOptions } from "../types/index"; +import { PlayerConfig } from "../types/index"; export class VP { videoElement: HTMLElement | null; @@ -16,9 +16,13 @@ export class VP { * @param {string} video The targeted video element * @param {PlayerConfig} config The config array */ - constructor(video: string, config: PlayerConfig) { + constructor(video: string | HTMLVideoElement, config: PlayerConfig) { this.config = config; - this.videoElement = document.querySelector(video); + if (video instanceof HTMLVideoElement) { + this.videoElement = video; + } else { + this.videoElement = document.querySelector(video); + } this.videoSources = this.videoElement?.querySelectorAll("source"); } }