Make highest quality default

This commit is contained in:
Carbrex 2024-02-06 22:56:12 +05:30
parent db6238394a
commit 9f10c2d5d2

View file

@ -34,7 +34,7 @@
hls.loadSource(playlist); hls.loadSource(playlist);
hls.attachMedia(newVideo); hls.attachMedia(newVideo);
hls.on(Hls.Events.MANIFEST_PARSED, function () { hls.on(Hls.Events.MANIFEST_PARSED, function () {
hls.loadLevel = 0; hls.loadLevel = hls.levels.length - 1;
var availableLevels = hls.levels.map(function(level) { var availableLevels = hls.levels.map(function(level) {
return { return {
height: level.height, height: level.height,
@ -79,7 +79,7 @@
option.text = level.height + 'p (' + bitrate + ' kbps)'; option.text = level.height + 'p (' + bitrate + ' kbps)';
qualitySelector.appendChild(option); qualitySelector.appendChild(option);
}); });
qualitySelector.selectedIndex = availableLevels.length - 1;
qualitySelector.addEventListener('change', function () { qualitySelector.addEventListener('change', function () {
var selectedIndex = qualitySelector.selectedIndex; var selectedIndex = qualitySelector.selectedIndex;
hlsInstance.nextLevel = selectedIndex; hlsInstance.nextLevel = selectedIndex;