Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flickering/blinking IMSC Subtitles #4359

Merged

Conversation

mattjuggins
Copy link
Contributor

This is detailed further in issue #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 #4103 & #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.

@dsilhavy dsilhavy added this to the 4.7.4 milestone Jan 16, 2024
@dsilhavy dsilhavy requested review from dsilhavy and bbert January 16, 2024 08:27
src/streaming/text/TextTracks.js Outdated Show resolved Hide resolved
src/streaming/text/TextTracks.js Outdated Show resolved Hide resolved
@dsilhavy dsilhavy merged commit b5f6135 into Dash-Industry-Forum:development Jan 18, 2024
3 checks passed
eirikbjornr pushed a commit to bbc/dash.js that referenced this pull request Feb 14, 2024
* Add proposed fix for subtitle flickering

* Refactor for clarity and use requestAnimationFrame

* Make sure to not effect CEA608 subs, and add comments for clarity

* Address PR comments
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.

3 participants