FIx multiple redundant transcodes

cap
Varun Patil 2022-12-01 12:48:29 -08:00
parent 2c51ef1116
commit 907eb2eb14
1 changed files with 15 additions and 4 deletions

View File

@ -210,13 +210,18 @@ class VideoContentSetup {
content.videojs.on("canplay", () => {
canPlay = true;
this.updateRotation(content); // also gets the correct video elem as a side effect
// Wait (also below) for the transition to end
window.setTimeout(() => this.initPlyr(content), 250);
window.setTimeout(() => this.initPlyr(content), 0);
});
content.videojs.qualityLevels()?.on("addqualitylevel", (e) => {
window.setTimeout(() => this.initPlyr(content), 250);
if (e.qualityLevel?.label?.includes("max.m3u8")) {
// This is the highest quality level
// and guaranteed to be the last one
this.initPlyr(content);
}
// Fallback
window.setTimeout(() => this.initPlyr(content), 0);
});
// Get correct orientation
@ -317,6 +322,12 @@ class VideoContentSetup {
content.plyr = plyr;
// Wait for animation to end before showing Plyr
plyr.elements.container.style.opacity = "0";
setTimeout(() => {
plyr.elements.container.style.opacity = "1";
}, 250);
// Restore original parent of video element
origParent.appendChild(content.videoElement);
// Move plyr to the slide container