Attempt for ios
This commit is contained in:
parent
c43e989459
commit
a7c1f13f99
56
index.html
56
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;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue