-
Notifications
You must be signed in to change notification settings - Fork 428
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: VTTCues with identical time intervals being incorrectly removed #1005
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested 608 and the stream that promted this and looking good.
if (duplicates.length) { | ||
duplicates.forEach(dupe => track.removeCue(dupe)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this happen after both forloops? It'll make it less likely that the loop fails because the cues list got updated from under it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following some offline discussion, we've decided to leave this as is. The loop will start with the first cue, remove any duplicates of it, progress to the second cue, remove any dupes of that, etc. And the length of the cues array is updated accordingly as duplicates are removed, so this should be safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic is way better here 👍 👍
I submitted the bug report that I believe led to this PR. In reviewing the code ran across a possible additional issue that wan't covered in the fix regarding simultaneous captions. In the code you mention that you're dropping captions if their time codes and text match. You might want to also consider cue position in this check as duplicate text is not always safe to purge. I have seen multiple examples in the past of simultaneous captions WITH the same text, but on opposite ends of the screen. (Think two people surprised and shouting: "Dude!?" from opposite ends of the screen.) |
Thanks @robflynn that definitely makes sense. Really, I think that our deduping should be limited to our 608 captions but I think it's not easy for us to differentiate where we do the deduping right now. |
Description
This is a replacement for #995, which was an attempt to revert a PR that resulted in WebVTT cues with identical time-intervals (which the spec allows) being removed from the cue list. However, simply reverting the change broke 608 captions, so another solution was required.
The main goals of this PR are to:
Solution
We can meet those criteria by only removing cues that have identical time intervals and identical text. This will ensure we remove any cues that overlap VTT segments, while keeping any cues that are actually intended to be displayed at the same time (which we can reasonably assume will have different text)
Specific Additions
removeDuplicateCuesFromTrack()
function in text-track utils