diff --git a/ui/component/viewers/videoViewer/internal/plugins/videojs-hls-quality-selector/plugin.js b/ui/component/viewers/videoViewer/internal/plugins/videojs-hls-quality-selector/plugin.js index dca99601f..4d31ce388 100644 --- a/ui/component/viewers/videoViewer/internal/plugins/videojs-hls-quality-selector/plugin.js +++ b/ui/component/viewers/videoViewer/internal/plugins/videojs-hls-quality-selector/plugin.js @@ -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(