feat: added prefix class and initialize of BasicUI
This commit is contained in:
@@ -7,12 +7,14 @@
|
|||||||
|
|
||||||
import { NativeAdapter } from "../adapters";
|
import { NativeAdapter } from "../adapters";
|
||||||
import { AdapterAPI, PlayerConfig } from "../types/index";
|
import { AdapterAPI, PlayerConfig } from "../types/index";
|
||||||
|
import { BaseUI } from "../ui";
|
||||||
|
|
||||||
export class VP {
|
export class VP {
|
||||||
private video: HTMLVideoElement;
|
private video: HTMLVideoElement;
|
||||||
private videoSrc?: NodeListOf<HTMLSourceElement>;
|
private videoSrc?: NodeListOf<HTMLSourceElement>;
|
||||||
private config?: PlayerConfig;
|
private config?: PlayerConfig;
|
||||||
private adapter: AdapterAPI;
|
private adapter: AdapterAPI;
|
||||||
|
private ui?: BaseUI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param video The targeted video element or id
|
* @param video The targeted video element or id
|
||||||
@@ -22,10 +24,13 @@ export class VP {
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
this.video = this.videoElement(video);
|
this.video = this.videoElement(video);
|
||||||
|
|
||||||
this.videoSrc = this.video?.querySelectorAll<HTMLSourceElement>("source");
|
this.videoSrc = this.video?.querySelectorAll<HTMLSourceElement>("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();
|
this.info();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export interface PlayerConfig {
|
|||||||
loop?: boolean;
|
loop?: boolean;
|
||||||
muted?: boolean;
|
muted?: boolean;
|
||||||
adapters?: AdapterConfig;
|
adapters?: AdapterConfig;
|
||||||
|
prefixClass: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ControlConfig {
|
export interface ControlConfig {
|
||||||
|
|||||||
Reference in New Issue
Block a user