Skip to content

fix: stack unpositioned subtitle cues so simultaneous subtitles do not overlap#1791

Open
mvanhorn wants to merge 1 commit into
anilbeesetti:mainfrom
mvanhorn:fix/1698-nextplayer-overlapping-subtitles
Open

fix: stack unpositioned subtitle cues so simultaneous subtitles do not overlap#1791
mvanhorn wants to merge 1 commit into
anilbeesetti:mainfrom
mvanhorn:fix/1698-nextplayer-overlapping-subtitles

Conversation

@mvanhorn

Copy link
Copy Markdown

Summary

Simultaneous subtitle cues no longer render on top of each other. External subtitle formats frequently emit multiple active cues with no position (line == Cue.DIMEN_UNSET); the Compose subtitle renderer drew each of them at the same default bottom position, so overlapping dialogue lines stacked onto one another illegibly. A new stackUnpositionedCues() extension assigns unpositioned cues consecutive bottom-anchored line numbers (-1, then upward, accounting for multi-line cue text), which is the same convention ExoPlayer's built-in view uses, and CuesState applies it wherever cues are read.

Why this matters

The reporter in #1698 hit this with subtitles that show two speakers at once — the second cue overprinted the first, making both unreadable. The fix only touches cues with unset positions; explicitly positioned cues pass through untouched, so styled/positioned subtitle formats keep their author-intended layout.

Testing

Added CueExtensionsTest covering: single unpositioned cue gets line -1, two simultaneous cues stack (-1, -2), a multi-line first cue pushes the next cue further up, positioned cues are left unchanged, and empty/singleton lists pass through. The unit test runs under :feature:player:testDefaultDebugUnitTest in CI (no local JVM toolchain on this machine).

Closes #1698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] overlapping subtitles

1 participant