diff --git a/src/core/VideoPlayer.ts b/src/core/VideoPlayer.ts index dfa387d..007e393 100644 --- a/src/core/VideoPlayer.ts +++ b/src/core/VideoPlayer.ts @@ -7,12 +7,14 @@ import { NativeAdapter } from "../adapters"; import { AdapterAPI, PlayerConfig } from "../types/index"; +import { BaseUI } from "../ui"; export class VP { private video: HTMLVideoElement; private videoSrc?: NodeListOf; private config?: PlayerConfig; private adapter: AdapterAPI; + private ui?: BaseUI; /** * @param video The targeted video element or id @@ -22,10 +24,13 @@ export class VP { this.config = config; this.video = this.videoElement(video); - this.videoSrc = this.video?.querySelectorAll("source"); - this.adapter = this.adapterInit(config.type); + this.adapter = this.adapterInit(this.config.type); + + if (config.controls) { + this.ui = new BaseUI(this, this.video, this.config.prefixClass); + } this.info(); } diff --git a/src/types/index.ts b/src/types/index.ts index 57ef09e..1a55086 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -26,6 +26,7 @@ export interface PlayerConfig { loop?: boolean; muted?: boolean; adapters?: AdapterConfig; + prefixClass: string; } export interface ControlConfig {