FAQ
If the problem is related to FairPlay, have you read the tutorial?
Not applicable
What version of Shaka Player are you using?
v5.1
Can you reproduce the issue with our latest release version?
Yes
Can you reproduce the issue with the latest code from main?
Yes
Are you using the demo app or your own custom app?
Both
What browser and OS are you using?
Chrome, macOS
For embedded devices (smart TVs, etc.), what model and firmware version are you using?
No response
What are the manifest and license server URIs?
Here's a 10 sec clip I've created for testing purposes.
Manifest: https://raw.githubusercontent.com/efkann/ttml-test/refs/heads/main/sample.mpd
Extra Shaka config:
{
"drm": {
"clearKeys": {
"d7f15ed6e31c5856e188710102029acc": "df0b5b811860327190a368d5e9de6a23"
}
}
}
What configuration are you using? What is the output of player.getNonDefaultConfiguration()?
{
"drm": {
"clearKeys": {
"d7f15ed6e31c5856e188710102029acc": "df0b5b811860327190a368d5e9de6a23"
}
}
}
What did you do?
I played this DASH stream in Shaka Player and selected the Turkish subtitle track:
https://github.com/efkann/ttml-test
Manifest:
https://raw.githubusercontent.com/efkann/ttml-test/main/sample.mpd
The stream contains fragmented MP4 TTML subtitles.
One affected subtitle segment is:
chunk_20250320T175630_9_350.m4s.m4v
Inside that segment, there is this TTML cue:
<p begin="00:11:39.781" end="00:11:40.700">
Beni hatırladın mı?
</p>
What did you expect to happen?
I expected the subtitle to stay visible until its explicit TTML end time: 00:11:40.700.
Media3 / ExoPlayer renders the same stream correctly and keeps this subtitle visible until the TTML cue end time.
What actually happened?
You can see "Beni hatırladın mı?" line disappearing too early, for testing purposes I could only post 10 seconds but same issue continues to happen for the whole movie.
The subtitle disappears at the DASH text segment boundary instead, around 00:11:40.
So the subtitle disappears about 0.7s before its explicit TTML end time.
I believe this is caused by lib/text/ttml_text_parser.js clipping TTML cue times to segment boundaries ?
if (this.manifestType_ !== shaka.media.ManifestParser.HLS) {
start = Math.max(start, timeContext.segmentStart);
end = Math.min(end, timeContext.segmentEnd);
}
It was likely added to address #4631, where repeated TTML cues across segment boundaries caused duplicate subtitles. However, in this stream the cue has an explicit TTML end time that extends past the segment boundary, and clipping causes it to disappear early.
I would like to send a PR for it, but I don't know how to fix it without breaking the duplicate issue. For my case, I'm patching in my custom player like below:
Parser.prototype.parseMedia = function patchedParseMedia(data, timeContext, uri) {
const patchedTimeContext = timeContext
? {
...timeContext,
// ExoPlayer-like experiment:
segmentEnd: Infinity,
}
: timeContext;
return originalParseMedia.call(this, data, patchedTimeContext, uri);
};
Feel free to close the issue if this the intended behaviour.
Are you planning to send a PR to add it?
No
FAQ
If the problem is related to FairPlay, have you read the tutorial?
Not applicable
What version of Shaka Player are you using?
v5.1
Can you reproduce the issue with our latest release version?
Yes
Can you reproduce the issue with the latest code from
main?Yes
Are you using the demo app or your own custom app?
Both
What browser and OS are you using?
Chrome, macOS
For embedded devices (smart TVs, etc.), what model and firmware version are you using?
No response
What are the manifest and license server URIs?
Here's a 10 sec clip I've created for testing purposes.
Manifest: https://raw.githubusercontent.com/efkann/ttml-test/refs/heads/main/sample.mpd
Extra Shaka config:
What configuration are you using? What is the output of
player.getNonDefaultConfiguration()?What did you do?
I played this DASH stream in Shaka Player and selected the Turkish subtitle track:
https://github.com/efkann/ttml-test
Manifest:
https://raw.githubusercontent.com/efkann/ttml-test/main/sample.mpd
The stream contains fragmented MP4 TTML subtitles.
One affected subtitle segment is:
chunk_20250320T175630_9_350.m4s.m4v
Inside that segment, there is this TTML cue:
What did you expect to happen?
I expected the subtitle to stay visible until its explicit TTML end time:
00:11:40.700.Media3 / ExoPlayer renders the same stream correctly and keeps this subtitle visible until the TTML cue end time.
What actually happened?
You can see "Beni hatırladın mı?" line disappearing too early, for testing purposes I could only post 10 seconds but same issue continues to happen for the whole movie.
The subtitle disappears at the DASH text segment boundary instead, around
00:11:40.So the subtitle disappears about
0.7sbefore its explicit TTMLendtime.I believe this is caused by
lib/text/ttml_text_parser.jsclipping TTML cue times to segment boundaries ?It was likely added to address #4631, where repeated TTML cues across segment boundaries caused duplicate subtitles. However, in this stream the cue has an explicit TTML
endtime that extends past the segment boundary, and clipping causes it to disappear early.I would like to send a PR for it, but I don't know how to fix it without breaking the duplicate issue. For my case, I'm patching in my custom player like below:
Feel free to close the issue if this the intended behaviour.
Are you planning to send a PR to add it?
No