Title: [295647] trunk
- Revision
- 295647
- Author
- [email protected]
- Date
- 2022-06-17 16:18:36 -0700 (Fri, 17 Jun 2022)
Log Message
Cues displayed during end time
https://bugs.webkit.org/show_bug.cgi?id=221854
<rdar://problem/74541188>
Patch by Youssef Soliman <[email protected]> on 2022-06-17
Reviewed by Eric Carlson.
Fixed edge case with cue intervals that had end times that coincided
with the current media time in order to follow the spec.
Test: media/track/track-cue-endtime.html
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateActiveTextTrackCues):
* LayoutTests/media/track/track-cue-endtime-expected.txt: Added.
* LayoutTests/media/track/track-cue-endtime.html: Added.
Canonical link: https://commits.webkit.org/251652@main
Modified Paths
Added Paths
Diff
Added: trunk/LayoutTests/media/track/track-cue-endtime-expected.txt (0 => 295647)
--- trunk/LayoutTests/media/track/track-cue-endtime-expected.txt (rev 0)
+++ trunk/LayoutTests/media/track/track-cue-endtime-expected.txt 2022-06-17 23:18:36 UTC (rev 295647)
@@ -0,0 +1,17 @@
+
+Test to ensure that a cue with an endtime equal to the current time is not active.
+
+RUN(textTrack = video.addTextTrack('subtitles'))
+RUN(textTrack.addCue(new VTTCue(1, 2, 'This should be gone by 2s.')))
+RUN(shouldBeActiveCue = new VTTCue(2, 3, 'This should appear alone at 2s.'))
+RUN(textTrack.addCue(shouldBeActiveCue))
+
+EVENT(canplaythrough)
+RUN(video.currentTime = 2)
+
+EVENT(seeked)
+EXPECTED (activeCues.length == '1') OK
+EXPECTED (shouldBeActiveCue == '[object VTTCue]') OK
+
+END OF TEST
+
Added: trunk/LayoutTests/media/track/track-cue-endtime.html (0 => 295647)
--- trunk/LayoutTests/media/track/track-cue-endtime.html (rev 0)
+++ trunk/LayoutTests/media/track/track-cue-endtime.html 2022-06-17 23:18:36 UTC (rev 295647)
@@ -0,0 +1,54 @@
+<!doctype html>
+<html>
+ <head>
+ <script src=""
+ <script src=""
+
+ <script>
+ let textTrack;
+ let shouldBeActiveCue;
+ let activeCues;
+
+ function setup()
+ {
+ findMediaElement();
+ video.src = "" "../content/test");
+
+ run("textTrack = video.addTextTrack('subtitles')");
+ run("textTrack.addCue(new VTTCue(1, 2, 'This should be gone by 2s.'))");
+ run("shouldBeActiveCue = new VTTCue(2, 3, 'This should appear alone at 2s.')");
+ run("textTrack.addCue(shouldBeActiveCue)");
+ consoleWrite("");
+ }
+
+ function canplaythrough()
+ {
+ run("video.currentTime = 2");
+ consoleWrite("");
+ }
+
+ function seeked()
+ {
+ activeCues = textTrack.activeCues;
+
+ testExpected('activeCues.length', 1);
+ testExpected('shouldBeActiveCue', activeCues[0]);
+ consoleWrite("");
+
+ endTest();
+ }
+
+ setCaptionDisplayMode('Automatic');
+
+ waitForEvent('canplaythrough', canplaythrough);
+
+ waitForEvent('seeked', seeked);
+
+ </script>
+ </head>
+ <body _onload_="setup()">
+ <video controls></video>
+
+ <p>Test to ensure that a cue with an endtime equal to the current time is not active.</p>
+ </body>
+</html>
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (295646 => 295647)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2022-06-17 23:09:22 UTC (rev 295646)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2022-06-17 23:18:36 UTC (rev 295647)
@@ -1682,7 +1682,10 @@
// The user agent must synchronously unset [the text track cue active] flag
// whenever ... the media element's readyState is changed back to HAVE_NOTHING.
if (m_readyState != HAVE_NOTHING && m_player) {
- currentCues = m_cueData->cueTree.allOverlaps({ movieTime, movieTime });
+ for (auto& cue : m_cueData->cueTree.allOverlaps({ movieTime, movieTime })) {
+ if (cue.low() <= movieTime && cue.high() > movieTime)
+ currentCues.append(cue);
+ }
if (currentCues.size() > 1)
std::sort(currentCues.begin(), currentCues.end(), &compareCueInterval);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes