Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE HTML>
<html>
<head>
<title>Test HEVC video playback</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="manifest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/**
* This test is used to check whether non-MSE HEVC video can be played on the
* platform. HEVC can only be played if we have platform decoder supports
* hardware decoding. Currently we can only do that on Windows.
*/
add_task(async function testHEVCPlayback() {
let video = document.createElement('video');
info(`try to play HEVC video`);
video.src = "hevc_white_frame.mp4";
video.controls = true;
document.body.appendChild(video);
ok(await video.play().then(_=>true, _=>false), "video started playing");
ok(await new Promise(r => video.onended = r).then(_=>true, _=>false),
"video played to end");
removeNodeAndSource(video);
});
// This test video contains an inband SPS that is different from the SPS in the
// extradata, so we would recreate a new decoder.
add_task(async function testHEVCInbandConfigChange() {
let video = document.createElement('video');
info(`try to play HEVC video`);
video.src = "hevc_white_red_frames.mp4";
video.playbackRate = 2.0; // speed up the test.
video.controls = true;
document.body.appendChild(video);
ok(await video.play().then(_=>true, _=>false), "video started playing");
ok(await new Promise(r => video.onended = r).then(_=>true, _=>false),
"video played to end");
removeNodeAndSource(video);
});
add_task(async function test8BitAnd10BitHEVC() {
const files = ['gizmo_hevc_8bit_420.mp4', 'gizmo_hevc_10bit_420.mp4'];
for (let file of files) {
let video = document.createElement('video');
info(`try to play ${file}`);
video.src = file;
video.controls = true;
document.body.appendChild(video);
ok(await video.play().then(_=>true, _=>false), "video started playing");
ok(await new Promise(r => video.onended = r).then(_=>true, _=>false),
"video played to end");
removeNodeAndSource(video);
}
});
</script>
</head>
<body>
</body>
</html>