Skip to content

Commit

Permalink
fix embedded subtitles not loading when subtitle filter on library
Browse files Browse the repository at this point in the history
  • Loading branch information
horizon1250 authored and nielsvanvelzen committed Oct 7, 2023
1 parent eb68107 commit a9cec1e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import timber.log.Timber;

Expand Down Expand Up @@ -554,10 +555,11 @@ public boolean setExoPlayerTrack(int index, @Nullable org.jellyfin.sdk.model.api

int chosenTrackType = streamType == org.jellyfin.sdk.model.api.MediaStreamType.SUBTITLE ? C.TRACK_TYPE_TEXT : C.TRACK_TYPE_AUDIO;

// Make sure the index is not out of bounds
if (index >= allStreams.size()) return false;
// Make sure the index is present
Optional<MediaStream> candidateOptional = allStreams.stream().filter(stream -> stream.getIndex() == index).findFirst();
if (!candidateOptional.isPresent()) return false;

org.jellyfin.sdk.model.api.MediaStream candidate = allStreams.get(index);
org.jellyfin.sdk.model.api.MediaStream candidate = candidateOptional.get();
if (candidate.isExternal() || candidate.getType() != streamType)
return false;

Expand Down

0 comments on commit a9cec1e

Please sign in to comment.