Diff
Modified: trunk/LayoutTests/media/track/track-forced-subtitles-in-band-expected.txt (295425 => 295426)
--- trunk/LayoutTests/media/track/track-forced-subtitles-in-band-expected.txt 2022-06-09 18:21:03 UTC (rev 295425)
+++ trunk/LayoutTests/media/track/track-forced-subtitles-in-band-expected.txt 2022-06-09 18:35:15 UTC (rev 295426)
@@ -9,7 +9,7 @@
EVENT(canplaythrough)
** Forced tracks should be in .textTracks, but not in the menu
-EXPECTED (video.textTracks.length == '9') OK
+EXPECTED (video.textTracks.length == '11') OK
** Only the 'fr' forced track should be showing
EXPECTED (video.textTracks[0].language == 'en') OK
@@ -48,11 +48,19 @@
EXPECTED (video.textTracks[8].kind == 'captions') OK
EXPECTED (video.textTracks[8].mode == 'disabled') OK
+EXPECTED (video.textTracks[9].language == 'es') OK
+EXPECTED (video.textTracks[9].kind == 'chapters') OK
+EXPECTED (video.textTracks[9].mode == 'hidden') OK
+
+EXPECTED (video.textTracks[10].language == 'en') OK
+EXPECTED (video.textTracks[10].kind == 'chapters') OK
+EXPECTED (video.textTracks[10].mode == 'hidden') OK
+
+** A cue should become active when current time is within its active range
RUN(video.currentTime = 9.5)
-
EVENT(seeked)
EVENT(cuechange)
-EXPECTED (video.textTracks[3].activeCues.length == '1') OK
+EXPECTED (video.textTracks[3].activeCues.length === 1 == 'true') OK
END OF TEST
Modified: trunk/LayoutTests/media/track/track-forced-subtitles-in-band.html (295425 => 295426)
--- trunk/LayoutTests/media/track/track-forced-subtitles-in-band.html 2022-06-09 18:21:03 UTC (rev 295425)
+++ trunk/LayoutTests/media/track/track-forced-subtitles-in-band.html 2022-06-09 18:35:15 UTC (rev 295426)
@@ -3,25 +3,26 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <script src=""
<script src=""
<script>
- function testVisibleCue()
+ async function testTracks()
{
- consoleWrite("");
- consoleWrite("EVENT(seeked)");
- consoleWrite("EVENT(cuechange)");
- testExpected("video.textTracks[3].activeCues.length", 1);
- consoleWrite("");
+ findMediaElement();
- endTest();
- }
-
- function testTracks()
- {
+ if (window.internals) {
+ run("internals.settings.setShouldDisplayTrackKind('Captions', false)");
+ run("internals.settings.setShouldDisplayTrackKind('Subtitles', true)");
+ run("internals.setUserPreferredLanguages(['en'])");
+ run("internals.setPrimaryAudioTrackLanguageOverride('fr')");
+ run("internals.setCaptionDisplayMode('ForcedOnly')");
+ }
+ video.src = '';
+
+ await waitFor(video, 'canplaythrough');
+
consoleWrite("<br><i>** Forced tracks should be in .textTracks, but not in the menu<" + "/i>");
- testExpected("video.textTracks.length", 9);
+ testExpected("video.textTracks.length", 11);
consoleWrite("<br><i>** Only the 'fr' forced track should be showing<" + "/i>");
testExpected("video.textTracks[0].language", "en");
@@ -69,29 +70,44 @@
testExpected("video.textTracks[8].mode", "disabled");
consoleWrite("");
- waitForEventsAndCall([[video, 'seeked'], [video.textTracks[3], 'cuechange']], testVisibleCue);
+ testExpected("video.textTracks[9].language", "es");
+ testExpected("video.textTracks[9].kind", "chapters");
+ testExpected("video.textTracks[9].mode", "hidden");
+ consoleWrite("");
+ testExpected("video.textTracks[10].language", "en");
+ testExpected("video.textTracks[10].kind", "chapters");
+ testExpected("video.textTracks[10].mode", "hidden");
+ consoleWrite("");
+
+ consoleWrite("<i>** A cue should become active when current time is within its active range<" + "/i>");
run("video.currentTime = 9.5");
- }
+ let result = await Promise.race([
+ Promise.all([
+ waitFor(video, 'seeked', true),
+ waitFor(video.textTracks[3], 'cuechange', true)
+ ]),
+ new Promise((resolve, reject) => { setTimeout(resolve, 5000, 'timeout'); })
+ ]);
- function setup()
- {
- findMediaElement();
- run("internals.settings.setShouldDisplayTrackKind('Captions', false)");
- run("internals.settings.setShouldDisplayTrackKind('Subtitles', true)");
- run("internals.setUserPreferredLanguages(['en'])");
- run("internals.setPrimaryAudioTrackLanguageOverride('fr')");
- run("internals.setCaptionDisplayMode('ForcedOnly')");
- video.src = '';
+ if (result === 'timeout') {
+ consoleWrite('');
+ failTest('Test timed out.');
+ }
- waitForEvent('canplaythrough', testTracks);
+ consoleWrite('EVENT(seeked)');
+ consoleWrite('EVENT(cuechange)');
+
+ testExpected('video.textTracks[3].activeCues.length === 1', true);
+ consoleWrite('');
+
+ endTest();
}
-
</script>
</head>
- <body _onload_="setup()">
+ <body _onload_='testTracks()'>
<p>Tests that forced subtitles are enable automatically.</p>
- <video width="640" height="360" controls>
+ <video width=640 height=360 controls>
</video>
</body>
</html>
Modified: trunk/LayoutTests/media/video-test.js (295425 => 295426)
--- trunk/LayoutTests/media/video-test.js 2022-06-09 18:21:03 UTC (rev 295425)
+++ trunk/LayoutTests/media/video-test.js 2022-06-09 18:35:15 UTC (rev 295426)
@@ -207,10 +207,8 @@
listener,
timeout,
]).then(result => {
- if (result === 'timeout') {
- Promise.reject(new Error(message));
- return;
- }
+ if (result === 'timeout')
+ return Promise.reject(new Error(message));
consoleWrite(`EVENT(${result.type})`);
return Promise.resolve(result);
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (295425 => 295426)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2022-06-09 18:21:03 UTC (rev 295425)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2022-06-09 18:35:15 UTC (rev 295426)
@@ -1834,8 +1834,6 @@
webkit.org/b/212219 media/track/track-cue-missing.html [ Pass Failure ]
-webkit.org/b/231333 media/track/track-forced-subtitles-in-band.html [ Pass Timeout Failure ]
-
webkit.org/b/228364 media/track/track-in-band-duplicate-tracks-when-source-changes.html [ Pass Timeout ]
webkit.org/b/230070 media/track/track-cue-css.html [ Pass ImageOnlyFailure Timeout ]
Modified: trunk/LayoutTests/platform/mac/TestExpectations (295425 => 295426)
--- trunk/LayoutTests/platform/mac/TestExpectations 2022-06-09 18:21:03 UTC (rev 295425)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2022-06-09 18:35:15 UTC (rev 295426)
@@ -801,8 +801,6 @@
# --- End media tests ---
-webkit.org/b/137505 media/track/track-forced-subtitles-in-band.html [ Failure Pass Timeout ]
-
# FIXME: Needs bugzilla (<rdar://problem/16040720>)
fast/canvas/canvas-scale-strokePath-shadow.html [ Pass Failure ]
Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp (295425 => 295426)
--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2022-06-09 18:21:03 UTC (rev 295425)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2022-06-09 18:35:15 UTC (rev 295426)
@@ -254,6 +254,8 @@
void TextTrackCueGeneric::toJSON(JSON::Object& object) const
{
+ VTTCue::toJSON(object);
+
if (m_foregroundColor.isValid())
object.setString("foregroundColor"_s, serializationForHTML(m_foregroundColor));
if (m_backgroundColor.isValid())
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (295425 => 295426)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2022-06-09 18:21:03 UTC (rev 295425)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2022-06-09 18:35:15 UTC (rev 295426)
@@ -2995,7 +2995,7 @@
{
AVMediaSelectionGroup *legibleGroup = safeMediaSelectionGroupForLegibleMedia();
if (!legibleGroup) {
- INFO_LOG(LOGIDENTIFIER, "no mediaSelectionGroup");
+ ALWAYS_LOG(LOGIDENTIFIER, "no mediaSelectionGroup");
return;
}
@@ -3061,8 +3061,10 @@
{
ASSERT(time >= MediaTime::zeroTime());
- if (!m_currentTextTrack)
+ if (!m_currentTextTrack) {
+ ALWAYS_LOG(LOGIDENTIFIER, "no current text track");
return;
+ }
m_currentTextTrack->processCue((__bridge CFArrayRef)attributedStrings, (__bridge CFArrayRef)nativeSamples, time);
}
@@ -3082,7 +3084,7 @@
if (m_currentTextTrack == track)
return;
- INFO_LOG(LOGIDENTIFIER, "selecting track with language ", track ? track->language() : emptyAtom());
+ ALWAYS_LOG(LOGIDENTIFIER, "selecting track with language ", track ? track->language() : emptyAtom());
m_currentTextTrack = track;