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 d600bc147..4bba2a6e5 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 @@ -111,29 +111,6 @@ class HlsQualitySelectorPlugin { concreteButtonInstance.removeClass('vjs-hidden'); } - resolveAutoQualityLabel(includeResolution) { - const player = this.player; - const vhs = player.tech(true).vhs; - - if (includeResolution && vhs) { - const pixelRatio = this.useDevicePixelRatio ? window.devicePixelRatio || 1 : 1; - - const selectedBandwidth = simpleSelector( - vhs.playlists.master, - vhs.systemBandwidth, - parseInt(safeGetComputedStyle(vhs.tech_.el_, 'width'), 10) * pixelRatio, - parseInt(safeGetComputedStyle(vhs.tech_.el_, 'height'), 10) * pixelRatio, - vhs.limitRenditionByPlayerDimensions - ); - - const quality = selectedBandwidth.attributes.RESOLUTION.height; - - return __('Auto (%quality%) --[Video quality popup. Long form.]--', { quality: quality + 'p' }); - } else { - return __('Auto --[Video quality. Short form]--'); - } - } - resolveOriginalQualityLabel(abbreviatedForm, includeResolution) { if (includeResolution && this.config.originalHeight) { return abbreviatedForm @@ -160,7 +137,7 @@ class HlsQualitySelectorPlugin { let str; switch (text) { case QUALITY_OPTIONS.AUTO: - str = this.resolveAutoQualityLabel(true); + str = QUALITY_OPTIONS.AUTO; break; case QUALITY_OPTIONS.ORIGINAL: str = this.resolveOriginalQualityLabel(true, false); @@ -227,6 +204,7 @@ class HlsQualitySelectorPlugin { levelItems = levelItems.map((item) => item === nextLowestQualityItem ? this.getQualityMenuItem.call(this, nextLowestQualityItemObj) : item ); + this._currentQuality = nextLowestQualityItemObj.value; } levelItems.sort((current, next) => { @@ -254,7 +232,7 @@ class HlsQualitySelectorPlugin { levelItems.push( this.getQualityMenuItem.call(this, { - label: this.resolveAutoQualityLabel(true), + label: QUALITY_OPTIONS.AUTO, value: QUALITY_OPTIONS.AUTO, selected: !defaultQuality ? true : defaultQuality === QUALITY_OPTIONS.AUTO, }) diff --git a/ui/component/viewers/videoViewer/internal/plugins/videojs-http-streaming--override/playlist-selectors.js b/ui/component/viewers/videoViewer/internal/plugins/videojs-http-streaming--override/playlist-selectors.js index 436cd6036..9de0066ca 100755 --- a/ui/component/viewers/videoViewer/internal/plugins/videojs-http-streaming--override/playlist-selectors.js +++ b/ui/component/viewers/videoViewer/internal/plugins/videojs-http-streaming--override/playlist-selectors.js @@ -205,19 +205,10 @@ export const lastBandwidthSelector = function() { const hlsQualitySelector = player.hlsQualitySelector; const originalHeight = hlsQualitySelector.config.originalHeight; - if (originalHeight && hlsQualitySelector) { - if (hlsQualitySelector.getCurrentQuality() === 'auto') { - if (selectedBandwidth.attributes.RESOLUTION.height === originalHeight) { - if (player.claimSrcOriginal && player.currentSrc() !== player.claimSrcOriginal?.src) { - setTimeout(() => { - const currentTime = player.currentTime(); - player.src(player.claimSrcOriginal); - player.currentTime(currentTime); - }); - } - } - } + if (hlsQualitySelector?.getCurrentQuality() === 'auto') { + hlsQualitySelector._qualityButton.menuButton_.$('.vjs-icon-placeholder').innerHTML = __('Auto(%quality%) --[Video quality popup. Long form.]--', { quality: selectedBandwidth.attributes.RESOLUTION.height + 'p' }); } + return selectedBandwidth; }; diff --git a/ui/component/viewers/videoViewer/view.jsx b/ui/component/viewers/videoViewer/view.jsx index 3ec5a96a5..d845246e1 100644 --- a/ui/component/viewers/videoViewer/view.jsx +++ b/ui/component/viewers/videoViewer/view.jsx @@ -33,8 +33,6 @@ import { lastBandwidthSelector } from './internal/plugins/videojs-http-streaming // const PLAY_TIMEOUT_LIMIT = 2000; const PLAY_POSITION_SAVE_INTERVAL_MS = 15000; -const USE_ORIGINAL_STREAM_FOR_OPTIMIZED_AUTO = false; - type Props = { position: number, changeVolume: (number) => void, @@ -388,15 +386,13 @@ function VideoViewer(props: Props) { player.on('loadedmetadata', () => restorePlaybackRate(player)); // Override "auto" to use non-vhs url when the quality matches. - if (USE_ORIGINAL_STREAM_FOR_OPTIMIZED_AUTO) { - player.on('loadedmetadata', () => { - const vhs = player.tech(true).vhs; - if (vhs) { - // https://github.com/videojs/http-streaming/issues/749#issuecomment-606972884 - vhs.selectPlaylist = lastBandwidthSelector; - } - }); - } + player.on('loadedmetadata', () => { + const vhs = player.tech(true).vhs; + if (vhs) { + // https://github.com/videojs/http-streaming/issues/749#issuecomment-606972884 + vhs.selectPlaylist = lastBandwidthSelector; + } + }); // used for tracking buffering for watchman player.on('tracking:buffered', doTrackingBuffered);