From a382326a38083d682394e36da23feab6efb1d707 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Fri, 17 Feb 2023 02:34:43 +0100 Subject: [PATCH] Use a player event to trigger the DASH quality selector creation (#3183) * Use a player event to trigger the DASH quality selector creation * Add requested comment --- .../ft-video-player/ft-video-player.js | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/renderer/components/ft-video-player/ft-video-player.js b/src/renderer/components/ft-video-player/ft-video-player.js index 03c1b349b..332ceb13e 100644 --- a/src/renderer/components/ft-video-player/ft-video-player.js +++ b/src/renderer/components/ft-video-player/ft-video-player.js @@ -445,15 +445,6 @@ export default defineComponent({ }) } - if (this.useDash) { - // this.dataSetup.plugins.httpSourceSelector = { - // default: 'auto' - // } - - // this.player.httpSourceSelector() - this.createDashQualitySelector(this.player.qualityLevels()) - } - if (this.autoplayVideos) { // Calling play() won't happen right away, so a quick timeout will make it function properly. setTimeout(() => { @@ -498,8 +489,10 @@ export default defineComponent({ this.player.on('wheel', this.mouseScrollSkip) } - this.player.on('fullscreenchange', this.fullscreenOverlay) - this.player.on('fullscreenchange', this.toggleFullscreenClass) + this.player.on('fullscreenchange', () => { + this.fullscreenOverlay() + this.toggleFullscreenClass() + }) this.player.on('ready', () => { this.$emit('ready') @@ -511,6 +504,16 @@ export default defineComponent({ }) this.player.one('loadedmetadata', () => { + if (this.useDash) { + // Reserved for switching back to videojs-http-quality-selector if needed + // this.dataSetup.plugins.httpSourceSelector = { + // default: 'auto' + // } + + // this.player.httpSourceSelector() + this.createDashQualitySelector(this.player.qualityLevels()) + } + this.checkAspectRatio() }) @@ -1501,12 +1504,6 @@ export default defineComponent({ }, createDashQualitySelector: function (levels) { - if (levels.levels_.length === 0) { - setTimeout(() => { - this.createDashQualitySelector(this.player.qualityLevels()) - }, 200) - return - } const adaptiveFormats = this.adaptiveFormats const activeAdaptiveFormats = this.activeAdaptiveFormats const setDashQualityLevel = this.setDashQualityLevel