FIx multiple redundant transcodes
parent
2c51ef1116
commit
907eb2eb14
|
@ -210,13 +210,18 @@ class VideoContentSetup {
|
||||||
content.videojs.on("canplay", () => {
|
content.videojs.on("canplay", () => {
|
||||||
canPlay = true;
|
canPlay = true;
|
||||||
this.updateRotation(content); // also gets the correct video elem as a side effect
|
this.updateRotation(content); // also gets the correct video elem as a side effect
|
||||||
|
window.setTimeout(() => this.initPlyr(content), 0);
|
||||||
// Wait (also below) for the transition to end
|
|
||||||
window.setTimeout(() => this.initPlyr(content), 250);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
content.videojs.qualityLevels()?.on("addqualitylevel", (e) => {
|
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
|
// Get correct orientation
|
||||||
|
@ -317,6 +322,12 @@ class VideoContentSetup {
|
||||||
|
|
||||||
content.plyr = plyr;
|
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
|
// Restore original parent of video element
|
||||||
origParent.appendChild(content.videoElement);
|
origParent.appendChild(content.videoElement);
|
||||||
// Move plyr to the slide container
|
// Move plyr to the slide container
|
||||||
|
|
Loading…
Reference in New Issue