From 2e01011dc80e9a2c688044ebbbe4ef8f9f8a29af Mon Sep 17 00:00:00 2001 From: db123 Date: Fri, 24 Apr 2026 23:55:15 +0330 Subject: [PATCH] fix: made type in config required throws error if not present --- src/core/VideoPlayer.ts | 3 +++ src/types/index.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/VideoPlayer.ts b/src/core/VideoPlayer.ts index 007e393..5f4fb61 100644 --- a/src/core/VideoPlayer.ts +++ b/src/core/VideoPlayer.ts @@ -26,6 +26,9 @@ export class VP { this.video = this.videoElement(video); this.videoSrc = this.video?.querySelectorAll("source"); + if (!this.config.type) { + throw new Error("Type not specified in config."); + } this.adapter = this.adapterInit(this.config.type); if (config.controls) { diff --git a/src/types/index.ts b/src/types/index.ts index 1a55086..33bfeec 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -17,7 +17,7 @@ export interface AdapterAPI { } export interface PlayerConfig { - type?: "native" | "hls" | "dash"; + type: "native" | "hls" | "dash"; theme?: "dark" | "light"; accent?: string; controls?: boolean | ControlConfig;