diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 7463b4b614..fe50820b50 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -1724,7 +1724,7 @@ class PlaybackManager { }).then(function (deviceProfile) { const audioStreamIndex = params.AudioStreamIndex == null ? getPlayerData(player).audioStreamIndex : params.AudioStreamIndex; const subtitleStreamIndex = params.SubtitleStreamIndex == null ? getPlayerData(player).subtitleStreamIndex : params.SubtitleStreamIndex; - const secondarySubtitleStreamIndex = params.SubtitleStreamIndex == null ? getPlayerData(player).secondarySubtitleStreamIndex : params.secondarySubtitleStreamIndex; + const secondarySubtitleStreamIndex = params.SecondarySubtitleStreamIndex == null ? getPlayerData(player).secondarySubtitleStreamIndex : params.SecondarySubtitleStreamIndex; let currentMediaSource = self.currentMediaSource(player); const apiClient = ServerConnections.getApiClient(currentItem.ServerId); @@ -2399,7 +2399,7 @@ class PlaybackManager { } } - function autoSetNextTracks(prevSource, mediaSource, audio, subtitle, secondarySubtitle) { + function autoSetNextTracks(prevSource, mediaSource, audio, subtitle) { try { if (!prevSource) return; @@ -2416,7 +2416,7 @@ class PlaybackManager { rankStreamType(prevSource.DefaultSubtitleStreamIndex, prevSource, mediaSource, 'Subtitle'); } - if (secondarySubtitle && typeof prevSource.DefaultSecondarySubtitleStreamIndex == 'number') { + if (subtitle && typeof prevSource.DefaultSecondarySubtitleStreamIndex == 'number') { rankStreamType(prevSource.DefaultSecondarySubtitleStreamIndex, prevSource, mediaSource, 'Subtitle', true); } } catch (e) { @@ -2484,14 +2484,14 @@ class PlaybackManager { return getPlaybackMediaSource(player, apiClient, deviceProfile, maxBitrate, item, startPosition, mediaSourceId, audioStreamIndex, subtitleStreamIndex).then(async (mediaSource) => { const user = await apiClient.getCurrentUser(); - const playerData = getPlayerData(player); - - autoSetNextTracks(prevSource, mediaSource, user.Configuration.RememberAudioSelections, user.Configuration.RememberSubtitleSelections, playerData.secondarySubtitleStreamIndex); + autoSetNextTracks(prevSource, mediaSource, user.Configuration.RememberAudioSelections, user.Configuration.RememberSubtitleSelections); const streamInfo = createStreamInfo(apiClient, item.MediaType, item, mediaSource, startPosition, player); streamInfo.fullscreen = playOptions.fullscreen; + const playerData = getPlayerData(player); + playerData.isChangingStream = false; playerData.maxStreamingBitrate = maxBitrate; playerData.streamInfo = streamInfo; diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index 646c902a5d..4a9d1a7bf9 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -491,20 +491,16 @@ function tryRemoveElement(elem) { this._currentPlayOptions = options; - // Get the secondary track that has been set during this watch session - let currentSecondaryTrackIndex = playbackManager.getSecondarySubtitleStreamIndex(this); - - if (!secondaryTrackValid) { - currentSecondaryTrackIndex = -1; - playbackManager.setSecondarySubtitleStreamIndex(currentSecondaryTrackIndex, this); - } - - this.#secondarySubtitleTrackIndexToSetOnPlaying = currentSecondaryTrackIndex == null ? -1 : currentSecondaryTrackIndex; - if (this.#secondarySubtitleTrackIndexToSetOnPlaying != null && this.#secondarySubtitleTrackIndexToSetOnPlaying >= 0) { - const initialSecondarySubtitleStream = options.mediaSource.MediaStreams[this.#secondarySubtitleTrackIndexToSetOnPlaying]; - if (!initialSecondarySubtitleStream || initialSecondarySubtitleStream.DeliveryMethod !== 'External') { - this.#secondarySubtitleTrackIndexToSetOnPlaying = -1; + if (secondaryTrackValid) { + this.#secondarySubtitleTrackIndexToSetOnPlaying = options.mediaSource.DefaultSecondarySubtitleStreamIndex == null ? -1 : options.mediaSource.DefaultSecondarySubtitleStreamIndex; + if (this.#secondarySubtitleTrackIndexToSetOnPlaying != null && this.#secondarySubtitleTrackIndexToSetOnPlaying >= 0) { + const initialSecondarySubtitleStream = options.mediaSource.MediaStreams[this.#secondarySubtitleTrackIndexToSetOnPlaying]; + if (!initialSecondarySubtitleStream || initialSecondarySubtitleStream.DeliveryMethod !== 'External') { + this.#secondarySubtitleTrackIndexToSetOnPlaying = -1; + } } + } else { + this.#secondarySubtitleTrackIndexToSetOnPlaying = -1; } const crossOrigin = getCrossOriginValue(options.mediaSource);