diff --git a/Shared/Extensions/JellyfinAPI/MediaStream.swift b/Shared/Extensions/JellyfinAPI/MediaStream.swift index 7b702acf9..9600e92e8 100644 --- a/Shared/Extensions/JellyfinAPI/MediaStream.swift +++ b/Shared/Extensions/JellyfinAPI/MediaStream.swift @@ -220,14 +220,17 @@ extension [MediaStream] { func adjustExternalSubtitleIndexes(audioStreamCount: Int) -> [MediaStream] { guard allSatisfy({ $0.type == .subtitle }) else { return self } let embeddedSubtitleCount = filter { !($0.isExternal ?? false) }.count + let externalSubtitleCount = filter { $0.isExternal ?? false }.count var mediaStreams = self for (i, mediaStream) in mediaStreams.enumerated() { - guard mediaStream.isExternal ?? false else { continue } var copy = mediaStream - copy.index = (copy.index ?? 0) + 1 + embeddedSubtitleCount + audioStreamCount - + if copy.isExternal ?? false { + copy.index = (copy.index ?? 0) + 1 + embeddedSubtitleCount + audioStreamCount + } else { + copy.index = (copy.index ?? 0) - externalSubtitleCount + } mediaStreams[i] = copy } diff --git a/Shared/Extensions/JellyfinAPI/SubtitleProfile.swift b/Shared/Extensions/JellyfinAPI/SubtitleProfile.swift index 6f124efc4..52939f5f5 100644 --- a/Shared/Extensions/JellyfinAPI/SubtitleProfile.swift +++ b/Shared/Extensions/JellyfinAPI/SubtitleProfile.swift @@ -34,7 +34,7 @@ extension SubtitleProfile { @ArrayBuilder containers: () -> [SubtitleFormat] ) -> [SubtitleProfile] { containers().map { - SubtitleProfile(container: $0.rawValue, method: method) + SubtitleProfile(container: nil, format: $0.rawValue, method: method) } } }