From fb68bb1419044d0c7b67c4a585b9b90502e00174 Mon Sep 17 00:00:00 2001 From: Ivan Schurawel Date: Wed, 15 Feb 2023 02:10:00 -0500 Subject: [PATCH] fix: define options before setting secondary track --- src/plugins/htmlVideoPlayer/plugin.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index b45bc4d84..646c902a5 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -487,6 +487,10 @@ function tryRemoveElement(elem) { secondaryTrackValid = false; } + this.#audioTrackIndexToSetOnPlaying = options.playMethod === 'Transcode' ? null : options.mediaSource.DefaultAudioStreamIndex; + + this._currentPlayOptions = options; + // Get the secondary track that has been set during this watch session let currentSecondaryTrackIndex = playbackManager.getSecondarySubtitleStreamIndex(this); @@ -503,10 +507,6 @@ function tryRemoveElement(elem) { } } - this.#audioTrackIndexToSetOnPlaying = options.playMethod === 'Transcode' ? null : options.mediaSource.DefaultAudioStreamIndex; - - this._currentPlayOptions = options; - const crossOrigin = getCrossOriginValue(options.mediaSource); if (crossOrigin) { elem.crossOrigin = crossOrigin;