summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_hevc_playback.html
blob: 6327008102fb8a3d172067badab8560237118f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE HTML>
<html>
<head>
<title>Test HEVC video playback</title>
<script src="/tests/SimpleTest/SimpleTest.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");

});


// 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");
});

</script>
</head>
<body>
</body>
</html>