fix(android): fixes selectedTextTrack type 'index' only ever matching the first track - #5031
Open
evoactivity wants to merge 1 commit into
Open
Conversation
…sition selectTextTrackInternal compared the requested index against trackIndex, the position inside each track group. Text tracks are typically mapped as one single-track group each, so trackIndex is 0 for every group and only index 0 could ever match; selecting any other index cleared existing overrides, logged 'Text track not found', and applied nothing. getTextTrackInfo numbers the tracks it reports to JS with a flat running position across all groups, so the selection side now counts the same way.
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.
Summary
On Android,
selectedTextTrack={{type: 'index', value: N}}is a silent no-op for anyN >= 1(regression in 6.16.0, introduced by #4581 — verified viagit log -S: the comparison first appears in that PR's commit, andv6.16.0is the first tag containing it).selectTextTrackInternalcompares the requested index againsttrackIndex, the position inside each track group. Text tracks are typically mapped as one single-track group each, sotrackIndexis0for every group: only index 0 can ever match. Selecting any other index clears existing overrides, logsText track not found for type=index … Keeping current selection, and applies nothing. If the stream has a default-flagged text track, it keeps rendering, which makes the failed selection easy to miss.Meanwhile
getTextTrackInfonumbers the tracks it reports throughonTextTrackswith a flat running position across all groups — so the index a JS app reads fromonTextTracksand feeds back intoselectedTextTracknever referred to the same track the selection side was looking for. (Before #4581, index selection resolved a track-group index, which matches the reported numbering for the common one-track-per-group mapping.)Changes
Count a flat position across all groups and their tracks in
selectTextTrackInternal, and match"index"against it — the same numberinggetTextTrackInforeports to JS.languageandtitlematching are untouched.Test plan
Any stream with 2+ text tracks reproduces it. A convenient source is fakestream, which generates synthetic test streams:
fakestream serve, then playhttp://localhost:8080/vod/multilingual.mkv(four SubRip tracks: eng, fra, spa, jpn, each cue prefixed[EN]/[FR]/[ES]/[JA]so the active track is visible at a glance). On a device or emulator, bridge the port first withadb reverse tcp:8080 tcp:8080, and use cleartext-permitted debug builds since the URL is plain http.{type: 'index', value: 1}leaves the previous track rendering (or the default-flagged track), withText track not found … Keeping current selectionin logcatselectedinonTextTracksfollows{type: 'disabled'}and{type: 'language'}behave as before