summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_hevc_support.html
blob: 36fe44a5007cd92796865c3ca5f43e3f7332b040 (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
46
47
<!DOCTYPE HTML>
<html>
<head>
<title>Test HEVC video support</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 we can get correct HEVC support information from
 * `canPlayType` and mediaCapabilities API on different platforms.
 */
add_task(async function testHEVCSupport() {
  const os = SpecialPowers.Services.appinfo.OS;

  const contentType = 'video/mp4; codecs="hev1.1.6.L93.B0"';
  const canPlay = document.createElement('video').canPlayType(contentType);
  if (os == "WINNT") {
    ok(canPlay != "", `HEVC is supported`);
  } else {
    ok(canPlay == "", "HEVC is not supported on current platform");
  }

  const videoConfiguration = {
    type: "file",
    video: {
      contentType,
      width: 1920,
      height: 1080,
      bitrate: 1000000,
      framerate: 30,
    },
  };
  const capability = await navigator.mediaCapabilities.decodingInfo(videoConfiguration);
  if (os == "WINNT") {
    ok(capability.supported, `HEVC is supported`);
    ok(capability.powerEfficient, `HEVC is powerEfficient`);
  } else {
    ok(!capability.supported, "HEVC is not supported on current platform");
  }
});

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