From 9dea386a8f806c285c192c3775125f0a4905b730 Mon Sep 17 00:00:00 2001 From: Meng-Huan Yu <2252236+cebrusfs@users.noreply.github.com> Date: Fri, 6 Sep 2024 04:46:27 +0900 Subject: [PATCH] Fix the subtitle stream index calculation for multiple subtitles (#1219) --- Shared/Extensions/JellyfinAPI/MediaStream.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Shared/Extensions/JellyfinAPI/MediaStream.swift b/Shared/Extensions/JellyfinAPI/MediaStream.swift index 58311db5f..7b702acf9 100644 --- a/Shared/Extensions/JellyfinAPI/MediaStream.swift +++ b/Shared/Extensions/JellyfinAPI/MediaStream.swift @@ -225,10 +225,10 @@ extension [MediaStream] { for (i, mediaStream) in mediaStreams.enumerated() { guard mediaStream.isExternal ?? false else { continue } - var _mediaStream = mediaStream - _mediaStream.index = 1 + embeddedSubtitleCount + audioStreamCount + var copy = mediaStream + copy.index = (copy.index ?? 0) + 1 + embeddedSubtitleCount + audioStreamCount - mediaStreams[i] = _mediaStream + mediaStreams[i] = copy } return mediaStreams