Revert "Fix original and livestream quality switch behavior"

This reverts commit 7a86d7a895.
This commit is contained in:
Thomas Zarebczan 2022-04-26 17:35:23 -04:00
parent 62fecf0403
commit 7effcd69e8

View file

@ -186,8 +186,7 @@ class HlsQualitySelectorPlugin {
selected: defaultQuality ? currentHeight === defaultQuality : undefined,
});
// Stop at index 0 since the list starts from max quality
const isLiveOriginal = defaultQuality === QUALITY_OPTIONS.ORIGINAL && player.isLivestream && i === 0;
const isLiveOriginal = defaultQuality && defaultQuality === QUALITY_OPTIONS.ORIGINAL && player.isLivestream;
const shouldCheckHeight =
defaultQuality && !nextLowestQualityItem && (currentHeight <= defaultQuality || isLiveOriginal);
@ -198,7 +197,6 @@ class HlsQualitySelectorPlugin {
value: currentHeight,
selected: true,
};
this.setQuality(currentHeight);
}
levelItems.push(levelItem);
@ -209,6 +207,7 @@ class HlsQualitySelectorPlugin {
levelItems = levelItems.map((item) =>
item === nextLowestQualityItem ? this.getQualityMenuItem.call(this, nextLowestQualityItemObj) : item
);
this._currentQuality = nextLowestQualityItemObj.value;
}
levelItems.sort((current, next) => {
@ -225,9 +224,6 @@ class HlsQualitySelectorPlugin {
});
if (!player.isLivestream) {
const videoEl = document.querySelector('.vjs-tech');
const didSwitch = videoEl.getAttribute('switched-from-default');
levelItems.push(
this.getQualityMenuItem.call(this, {
label: this.resolveOriginalQualityLabel(false, true),
@ -235,12 +231,6 @@ class HlsQualitySelectorPlugin {
selected: defaultQuality ? defaultQuality === QUALITY_OPTIONS.ORIGINAL : false,
})
);
if (defaultQuality === QUALITY_OPTIONS.ORIGINAL && !didSwitch) {
this.swapSrcTo(QUALITY_OPTIONS.ORIGINAL);
// Add this attribute to the video player so later it can be checked and avoid switching again
// Since this is only for initial load, based on the default quality setting
videoEl.setAttribute('switched-from-default', true);
}
}
levelItems.push(