mirror of
https://github.com/jellyfin/jellyfin-android.git
synced 2026-10-26 16:45:26 +00:00
Fix external subtitle selection
A recent (?) AndroidX Media3 update caused MergingMediaPeriod to prepend the period ID to the track format's id, breaking the actual track selection. Only matching the substring fixes selecting external subtitles.
This commit is contained in:
1 parent
e637337eff
commit
6be3652bdc
1 file changed
+5
-1
@@ -153,7 +153,11 @@ class TrackSelectionHelper(
|
||||
SubtitleDeliveryMethod.EXTERNAL -> {
|
||||
// For external subtitles, we can simply match the ID that we set when creating the player media source.
|
||||
for (group in player.currentTracks.groups) {
|
||||
if (group.getTrackFormat(0).id == "${ExternalSubtitleStream.ID_PREFIX}${subtitleStream.index}") {
|
||||
val formatId = group.getTrackFormat(0).id ?: continue
|
||||
val originalFormatPrefixIndex = formatId.indexOf(ExternalSubtitleStream.ID_PREFIX)
|
||||
if (originalFormatPrefixIndex < 0) continue
|
||||
val originalFormatId = formatId.substring(originalFormatPrefixIndex)
|
||||
if (originalFormatId == "${ExternalSubtitleStream.ID_PREFIX}${subtitleStream.index}") {
|
||||
return trackSelector.selectTrackByTypeAndGroup(C.TRACK_TYPE_TEXT, group.mediaTrackGroup)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user