Skip to content

Conversation

ryanmccartney
Copy link

@ryanmccartney ryanmccartney commented Sep 3, 2025

Port changes made by @mattjuggins in #4359 released in Dash-Industry-Forum/dash.js v4.7.4.

As seen below, the main stated aim of the PR was to resolve a flickering/blinking issues when rendering subtitles using IMSC.

This port preserves the passing of customisation options to IMSC,

This is detailed further in issue Dash-Industry-Forum#4358.

This is a proposed fix to prevent subtitle flickering, where the time between removal and appending of divs representing subtitle cues can have gaps in between. Using the stream in the reference player titled “[BBC] On-demand Elephant's Dream - with EBU-TT-D 'Snaking' Subtitle Track (random text) - lines grow over time simulating live subtitles”, it’s clear to see the effect before and after this code is applied.

These changes preserve the work done by @bbert in Dash-Industry-Forum#4103 & Dash-Industry-Forum#4155. Extending identical cues is still preserved and I have checked the test stream mentioned in the PR still operates as expected. Additionally, this PR doesn’t affect the operation of WebVTT subtitles or CEA608 captions. The intent is to just target imsc subtitles where this flickering effect has been witnessed.

The following changes have been made:

* Clear up the `captionsContainer` immediately before adding new elements in `_renderCaption()`.

* Use requestAnimationFrame (where available) for performance benefits and to ensure drawing as a cause of `_renderCaption()` happens in the same frame (it should if not available anyway now).

* If cues are adjacent, and not identical, make sure they are cleaned up within `_renderCaption()` and not at a different time by the `onexit` event. Ensure this only happens for imsc subs.

* Refactor around `_extendLastCue()` for clarity.

* Separate out arguments for the imscJS `renderHTML` function, for readability. I have not changed the arguments, just the formatting.

@ryanmccartney ryanmccartney marked this pull request as ready for review September 3, 2025 09:12
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.

2 participants