From d772b36717cf27ac969275dc34b85dc22eb6bea5 Mon Sep 17 00:00:00 2001 From: Ayla Ounce Date: Mon, 4 Nov 2024 21:34:01 -0800 Subject: [PATCH] Fix exo track id parsing for format change. Without this changing to other audio tracks fails, it just keeps playing the first one in the file. I was tipped off to the source of the problem by lines like this in logcat: 11-04 19:26:01.244 11669 11669 D VideoManager: failed to parse track ID [0:2] It appears exoplayer changed from a simple number for trackid to two numbers separated by a colon. Haven't had any luck tracking down why, but the latter of the two appears to match the old single number so, just pull that out and use it. --- .../jellyfin/androidtv/ui/playback/VideoManager.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/jellyfin/androidtv/ui/playback/VideoManager.java b/app/src/main/java/org/jellyfin/androidtv/ui/playback/VideoManager.java index 93588a8e9a..ddf9327f2c 100644 --- a/app/src/main/java/org/jellyfin/androidtv/ui/playback/VideoManager.java +++ b/app/src/main/java/org/jellyfin/androidtv/ui/playback/VideoManager.java @@ -415,7 +415,11 @@ public int getExoPlayerTrack(@Nullable org.jellyfin.sdk.model.api.MediaStreamTyp if (trackFormat.id != null) { int id; try { - id = Integer.parseInt(trackFormat.id); + if (trackFormat.id.contains(":")) { + id = Integer.parseInt(trackFormat.id.split(":")[1]); + } else { + id = Integer.parseInt(trackFormat.id); + } } catch (NumberFormatException e) { Timber.d("failed to parse track ID [%s]", trackFormat.id); break; @@ -483,7 +487,11 @@ public boolean setExoPlayerTrack(int index, @Nullable org.jellyfin.sdk.model.api int id; try { - id = Integer.parseInt(trackFormat.id); + if (trackFormat.id.contains(":")) { + id = Integer.parseInt(trackFormat.id.split(":")[1]); + } else { + id = Integer.parseInt(trackFormat.id); + } if (id != exoTrackID) continue; } catch (NumberFormatException e) {