video: add HLS fallback

pull/221/head
Varun Patil 2022-11-08 21:52:08 -08:00
parent 99ec1a50cc
commit 3d35741ed0
1 changed files with 12 additions and 1 deletions

View File

@ -95,7 +95,6 @@ class VideoContentSetup {
...hlsSources,
{
src: e.slide.data.src,
label: "Original",
},
],
preload: "metadata",
@ -108,6 +107,18 @@ class VideoContentSetup {
},
});
content.videojs.on("error", function () {
if (this.error().code === 4) {
if (this.src().includes("m3u8")) {
// HLS could not be streamed
console.error("Video.js: HLS stream could not be opened.");
this.src({
src: e.slide.data.src,
});
}
}
});
content.videojs.qualityLevels();
content.videojs.hlsQualitySelector({
displayCurrentQuality: true,