You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SSA and SubRip in-progress cue is not rendered when subtitle track is selected after cue's start time #2309
When selecting a subtitle track after playback has passed the cue’s start time, and the subtitle file contains only one cue, no subtitle is rendered.
However, if the subtitle file has two or more cues, the same behavior works correctly — the cue that overlaps with current playback time is displayed as expected.
Expected behavior
Even if a subtitle file contains only one cue, and the track is selected after the cue’s start time but before its end time, the cue should be rendered if it's currently active.
Steps to reproduce
Create a .vtt file with only one cue:
1
00:00:00,000 --> 00:00:10,000
Hello world!
Start playback and seek to 5 seconds (after the cue's start time).
Select the subtitle track at 5 seconds.
Observe that no subtitles are shown.
Check onCues(List) — it is triggered but receives an empty list.
Root Cause Hypothesis
ExoPlayer’s internal logic likely relies on multiple cues to construct a timeline for cue scheduling.
When only one cue exists, and the current playback position is past its start time, there’s no scheduling opportunity, so the cue is skipped.
This results in onCues() being called with an empty list, even though the cue should be active.
When selecting a subtitle track after playback has passed the cue’s start time, and the subtitle file contains only one cue, no subtitle is rendered.
I can reproduce this using the provided subrip snippet.
However, if the subtitle file has two or more cues, the same behavior works correctly — the cue that overlaps with current playback time is displayed as expected.
I can't reproduce this. When I modify the subrip file to the following, and then repeat your steps, I don't see "Hello world!" displayed, only "Hello two" when playback reaches 11s.
Aside: This doesn't look like a valid WebVTT file - it looks like maybe SubRip? To be be WebVTT it must start with WEBVTT and then a blank line before the cues - and the cue timestamps must use . for the separator between seconds and milliseconds.
When I use the following two WebVTT snippets (single cue and two cues), I see the subtitles appear when the track is enabled at 5s (i.e. the issue doesn't repro).
So in summary: This issue repros with SubRip but not with WebVTT (regardless of the number of cues).
This happens because of these comparisons with cue 'start time' instead of 'end time'. I've sent a change for review which changes this (and same in SsaParser too), which results in the cues showing up as soon as the subtitles are enabled at 5s.
changed the title [-]Subtitle cue not rendered when subtitle track contains only one cue and selected after cue's start time[/-][+]SSA and SubRip in-progress cue is not rendered when subtitle track is selected after cue's start time[/+]on Apr 25, 2025
Activity
peerless2012 commentedon Apr 10, 2025
I noticed same issue.
icbaker commentedon Apr 25, 2025
I can reproduce this using the provided subrip snippet.
I can't reproduce this. When I modify the subrip file to the following, and then repeat your steps, I don't see "Hello world!" displayed, only "Hello two" when playback reaches 11s.
Aside: This doesn't look like a valid WebVTT file - it looks like maybe SubRip? To be be WebVTT it must start with
WEBVTTand then a blank line before the cues - and the cue timestamps must use.for the separator between seconds and milliseconds.When I use the following two WebVTT snippets (single cue and two cues), I see the subtitles appear when the track is enabled at 5s (i.e. the issue doesn't repro).
So in summary: This issue repros with SubRip but not with WebVTT (regardless of the number of cues).
This happens because of these comparisons with cue 'start time' instead of 'end time'. I've sent a change for review which changes this (and same in
SsaParsertoo), which results in the cues showing up as soon as the subtitles are enabled at 5s.media/libraries/extractor/src/main/java/androidx/media3/extractor/text/subrip/SubripParser.java
Lines 169 to 174 in dae5ebb
media/libraries/extractor/src/main/java/androidx/media3/extractor/text/SubtitleExtractor.java
Lines 262 to 264 in dae5ebb
peerless2012 commentedon Apr 25, 2025
Does this change fix for aas subtitles?
icbaker commentedon Apr 25, 2025
My change modifies the equivalent
startTimeUs >= outputOptions.startTimeUscheck in bothSubripParserandSsaParser.Fix SSA and SRT to display an in-progress cue when enabling subtitles
[-]Subtitle cue not rendered when subtitle track contains only one cue and selected after cue's start time[/-][+]SSA and SubRip in-progress cue is not rendered when subtitle track is selected after cue's start time[/+]