summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/mediacapture-record/MediaRecorder-start.html
blob: 4e3c252e8d1c31b82c466b79a26ba38804dc0831 (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
<!doctype html>
<html>
<head>
  <title>MediaRecorder Start</title>
  <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#dom-mediarecorder-start">
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
</head>
<body>
<canvas id="canvas" width="200" height="200">
</canvas>
<script>
    function createVideoStream() {
        canvas.getContext('2d');
        return canvas.captureStream();
    }

    test(t => {
        const mimeType = [ 'audio/aac', 'audio/ogg', 'audio/webm', 'audio/mp4' ].find(MediaRecorder.isTypeSupported);
        const mediaRecorder = new MediaRecorder(createVideoStream(), {mimeType});
        assert_throws_dom("NotSupportedError", () => mediaRecorder.start());
    }, "MediaRecorder cannot record the stream using the current configuration");
</script>
</body>
</html>