Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /mediacapture-record/MediaRecorder-start.html - WPT Dashboard Interop Dashboard
<!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>