diff --git a/index.html b/index.html
index 742bdb3..7c051a4 100644
--- a/index.html
+++ b/index.html
@@ -38,41 +38,33 @@
app.ports.initVideo.subscribe(function(arg) {
const video = document.getElementById('video');
- const hls = new Hls();
- hls.loadSource(arg);
+ if (Hls.isSupported()) {
+ const hls = new Hls();
+ hls.loadSource(arg);
- hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
- // Transform available levels into an array of integers (height values).
- const availableQualities = hls.levels.map((l) => l.height);
- availableQualities.unshift(0);
- app.ports.nowHasQualities.send(availableQualities);
- });
+ hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
+ // Transform available levels into an array of integers (height values).
+ const availableQualities = hls.levels.map((l) => l.height);
+ availableQualities.unshift(0);
+ app.ports.nowHasQualities.send(availableQualities);
+ });
- hls.on(Hls.Events.LEVEL_SWITCHED, function (event, data) {
- // var span = document.querySelector(".plyr__menu__container [data-plyr='quality'][value='0'] span");
- // if (hls.autoLevelEnabled) {
- // span.innerHTML = "Auto (" + hls.levels[data.level].height + "p)";
- // } else {
- // span.innerHTML = "Auto";
- // }
- // var x = document.querySelectorAll(".plyr__menu__container [data-plyr='settings'] span")[3];
- // if (x.innerHTML.startsWith("Auto") || x.innerHTML === "0p") {
- // x.innerHTML = span.innerHTML;
- // }
- })
+ hls.on(Hls.Events.LEVEL_SWITCHED, function (event, data) {
+ // var span = document.querySelector(".plyr__menu__container [data-plyr='quality'][value='0'] span");
+ // if (hls.autoLevelEnabled) {
+ // span.innerHTML = "Auto (" + hls.levels[data.level].height + "p)";
+ // } else {
+ // span.innerHTML = "Auto";
+ // }
+ // var x = document.querySelectorAll(".plyr__menu__container [data-plyr='settings'] span")[3];
+ // if (x.innerHTML.startsWith("Auto") || x.innerHTML === "0p") {
+ // x.innerHTML = span.innerHTML;
+ // }
+ })
- hls.attachMedia(video);
-
- function updateQuality(newQuality) {
- if (newQuality === 0) {
- hls.currentLevel = -1;
- } else {
- hls.levels.forEach((level, levelIndex) => {
- if (level.height === newQuality) {
- hls.currentLevel = levelIndex;
- }
- });
- }
+ hls.attachMedia(video);
+ } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
+ video.src = arg;
}
});