fix: made type in config required
throws error if not present
This commit is contained in:
@@ -26,6 +26,9 @@ export class VP {
|
|||||||
this.video = this.videoElement(video);
|
this.video = this.videoElement(video);
|
||||||
this.videoSrc = this.video?.querySelectorAll<HTMLSourceElement>("source");
|
this.videoSrc = this.video?.querySelectorAll<HTMLSourceElement>("source");
|
||||||
|
|
||||||
|
if (!this.config.type) {
|
||||||
|
throw new Error("Type not specified in config.");
|
||||||
|
}
|
||||||
this.adapter = this.adapterInit(this.config.type);
|
this.adapter = this.adapterInit(this.config.type);
|
||||||
|
|
||||||
if (config.controls) {
|
if (config.controls) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export interface AdapterAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface PlayerConfig {
|
export interface PlayerConfig {
|
||||||
type?: "native" | "hls" | "dash";
|
type: "native" | "hls" | "dash";
|
||||||
theme?: "dark" | "light";
|
theme?: "dark" | "light";
|
||||||
accent?: string;
|
accent?: string;
|
||||||
controls?: boolean | ControlConfig;
|
controls?: boolean | ControlConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user