blob: 106ad06059c61068db9fc30402ba9d57cb2eb781 (
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>
<meta name="timeout" content="long">
<head>
<title>MediaRecorder peer connection</title>
<link rel="help"
href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#dom-mediarecorder-mimeType">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="../mediacapture-streams/permission-helper.js"></script>
<script src="utils/peerconnection.js"></script>
</head>
<body>
<script>
promise_setup(async () => {
const t = {add_cleanup: add_completion_callback};
const [, pc, stream] = await startConnection(t, true, true);
const [audio] = stream.getAudioTracks();
const [video] = stream.getVideoTracks();
for (const kinds of [{ audio }, { video }, { audio, video }]) {
const tag = `${JSON.stringify(kinds)}`;
const stream = new MediaStream([kinds.audio, kinds.video].filter(n => n));
promise_test(async t => {
const recorder = new MediaRecorder(stream);
recorder.start(200);
let combinedSize = 0;
// Wait for a small amount of data to appear. Kept small for mobile tests
while (combinedSize < 2000) {
const {data} = await new Promise(r => recorder.ondataavailable = r);
combinedSize += data.size;
}
recorder.stop();
}, `MediaRecorder records from PeerConnection without sinks, ${tag}`);
}
});
</script>
</body>
</html>
|