Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: isolated_process OR mda_gpu && os == 'mac' && os_version == '10.15'
- Manifest: dom/media/test/mochitest.toml
<!DOCTYPE html>
<html>
<head>
<title>MKV playback test</title>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<pre id="test">
<script>
/**
* This test verifies supported codecs in MKV files play to the end.
*/
add_task(async function test_supported_mkv_sources() {
await SpecialPowers.pushPrefEnv({
set: [["media.mkv.enabled", true]]
});
for (const test of gMKVtests) {
let v = document.createElement("video");
document.body.appendChild(v);
v.src = test.name;
v.preload = "auto";
info(`Starting to play ${test.name}`);
// Mime type check
let canPlay = v.canPlayType(test.type);
is(canPlay, "probably", `canPlayType(${canPlay}) should be 'probably' for ${test.type}`);
let legacyType = test.type.replace(/^(audio|video)\//, "$1/x-");
canPlay = v.canPlayType(legacyType);
is(canPlay, "probably", `canPlayType(${canPlay}) should be 'probably' for ${legacyType}`);
// Playback check
let endPromise = once(v, "ended");
ok(await v.play().then(_ => true, _ => false), "media started playing successfully");
await endPromise;
ok(true, `${test.name} played to the end`);
removeNodeAndSource(v);
}
});
</script>
</pre>
</body>
</html>