From 103cce1a353b3569a1b956ba77da8a11ef29c51a Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 14 Nov 2022 01:10:43 -0800 Subject: [PATCH] video: fix initial quality switch --- src/components/PsVideo.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/PsVideo.ts b/src/components/PsVideo.ts index 6cbddbb5..1d35a678 100644 --- a/src/components/PsVideo.ts +++ b/src/components/PsVideo.ts @@ -215,6 +215,12 @@ class VideoContentSetup { this.initPlyr(content); }); + content.videojs.qualityLevels()?.on("addqualitylevel", (e) => { + window.setTimeout(() => { + this.initPlyr(content); + }, 0); + }); + // Get correct orientation axios .get( @@ -251,6 +257,9 @@ class VideoContentSetup { initPlyr(content: any) { if (content.plyr) return; + content.videoElement = content.videojs?.el()?.querySelector("video"); + if (!content.videoElement) return; + // Retain original parent for video element const origParent = content.videoElement.parentElement;