Add audio and subtitle track selection to new video player - #5527
Open
johnpc wants to merge 4 commits into
Open
Conversation
- Add TrackSelectionBackend interface to playback core - Implement track selection in ExoPlayerBackend using TrackSelectionOverride - Add ExternalSubtitle support - loads external subs via SubtitleConfiguration - Expose trackSelection property on PlaybackManager - Add AudioTrackButton and SubtitleTrackButton Compose UI components - Wire up buttons in VideoPlayerControls - Audio button hidden when <2 tracks, subtitle button hidden when no tracks This brings the new player closer to feature parity with the old player.
Contributor
|
@johnpc please keep an eye on contrast issues when it comes to UI elements. The light checkmark on the light selector background is hard for some people to see. The checkmark should be dark when selected. |
Use Button's inherited content color for the checkmark icon instead of a fixed color. This ensures proper contrast - dark checkmark on light focused background, light checkmark on dark unfocused background.
Contributor
Author
| <string name="lbl_playback_speed">Playback speed</string> | ||
| <string name="lbl_quality_profile">Quality profile</string> | ||
| <string name="lbl_subtitle_track">Select subtitle track</string> | ||
| <string name="no_tracks_available">No tracks available</string> |
| // Add external subtitles | ||
| if (stream.externalSubtitles.isNotEmpty()) { | ||
| setSubtitleConfigurations(stream.externalSubtitles.map { sub -> | ||
| MediaItem.SubtitleConfiguration.Builder(android.net.Uri.parse(sub.url)) |
Comment on lines
+123
to
+130
| private fun TrackSelectionPopover( | ||
| expanded: Boolean, | ||
| onDismissRequest: () -> Unit, | ||
| tracks: List<PlayerTrack>, | ||
| title: String, | ||
| showNoneOption: Boolean = false, | ||
| onTrackSelected: (PlayerTrack?) -> Unit, | ||
| ) { |
| expanded = expanded, | ||
| onDismissRequest = onDismissRequest, | ||
| alignment = Alignment.TopCenter, | ||
| offset = DpOffset(0.dp, (-5).dp), |
| val languageName = language?.let { code -> | ||
| try { | ||
| Locale.forLanguageTag(code).displayLanguage.takeIf { it.isNotBlank() && it != code } | ||
| } catch (e: Exception) { |
| val languageName = language?.let { code -> | ||
| try { | ||
| Locale.forLanguageTag(code).displayLanguage.takeIf { it.isNotBlank() && it != code } | ||
| } catch (e: Exception) { |
| return tracks | ||
| } | ||
|
|
||
| override fun selectTrack(type: TrackType, index: Int): Boolean { |
| .build() | ||
| exoPlayer.trackSelectionParameters = params | ||
| true | ||
| } catch (e: Exception) { |
…track-selection # Conflicts: # app/src/main/java/org/jellyfin/androidtv/ui/player/video/VideoPlayerControls.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Changes
Adds audio and subtitle track selection to the new Compose-based video player, bringing it closer to feature parity with the old player.