blob: 8a63f968f0465af6dff1242e3ac5397dbab9275a [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src=../trackmenu-test.js></script>
<script src=../video-test.js></script>
<script>
function testVisibleCue()
{
consoleWrite("");
consoleWrite("EVENT(seeked)");
consoleWrite("EVENT(cuechange)");
testExpected("video.textTracks[3].activeCues.length", 1);
consoleWrite("");
endTest();
}
function testTracks()
{
consoleWrite("<br><i>** Forced tracks should be in .textTracks, but not in the menu<" + "/i>");
testExpected("video.textTracks.length", 9);
consoleWrite("<br><i>** Only the 'fr' forced track should be showing<" + "/i>");
testExpected("video.textTracks[0].language", "en");
testExpected("video.textTracks[0].kind", "subtitles");
testExpected("video.textTracks[0].mode", "disabled");
consoleWrite("");
testExpected("video.textTracks[1].language", "en");
testExpected("video.textTracks[1].kind", "forced");
testExpected("video.textTracks[1].mode", "disabled");
consoleWrite("");
testExpected("video.textTracks[2].language", "fr");
testExpected("video.textTracks[2].kind", "subtitles");
testExpected("video.textTracks[2].mode", "disabled");
consoleWrite("");
testExpected("video.textTracks[3].language", "fr");
testExpected("video.textTracks[3].kind", "forced");
testExpected("video.textTracks[3].mode", "showing");
consoleWrite("");
testExpected("video.textTracks[4].language", "es");
testExpected("video.textTracks[4].kind", "subtitles");
testExpected("video.textTracks[4].mode", "disabled");
consoleWrite("");
testExpected("video.textTracks[5].language", "es");
testExpected("video.textTracks[5].kind", "forced");
testExpected("video.textTracks[5].mode", "disabled");
consoleWrite("");
testExpected("video.textTracks[6].language", "de");
testExpected("video.textTracks[6].kind", "subtitles");
testExpected("video.textTracks[6].mode", "disabled");
consoleWrite("");
testExpected("video.textTracks[7].language", "de");
testExpected("video.textTracks[7].kind", "forced");
testExpected("video.textTracks[7].mode", "disabled");
consoleWrite("");
testExpected("video.textTracks[8].language", "en");
testExpected("video.textTracks[8].kind", "captions");
testExpected("video.textTracks[8].mode", "disabled");
consoleWrite("");
waitForEventsAndCall([[video, 'seeked'], [video.textTracks[3], 'cuechange']], testVisibleCue);
run("video.currentTime = 9.5");
}
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 = '../content/CC+Subtitles.mov';
waitForEvent('canplaythrough', testTracks);
}
</script>
</head>
<body onload="setup()">
<p>Tests that forced subtitles are enable automatically.</p>
<video width="640" height="360" controls>
</video>
</body>
</html>