-
Notifications
You must be signed in to change notification settings - Fork 25
/
test.html
41 lines (35 loc) · 1.48 KB
/
test.html
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
<!DOCTYPE html>
<html>
<head>
<title>attachMediaStream</title>
</head>
<body>
<p>muted</p>
<video id="muted" width="300" height="200"></video>
<p>not auto played</p>
<video id="noautoplay" width="300" height="200"></video>
<p>mirrored</p>
<video id="mirrored" width="300" height="200"></video>
<p>audio only</p>
<audio id="audio" controls></audio>
<p>generated</p>
<div id="vidContainer"></div>
<script src="node_modules/webrtc-adapter/out/adapter.js"></script>
<script src="attachmediastream.bundle.js"></script>
<script>
navigator.mediaDevices.getUserMedia({audio: true, video: true})
.then(function(stream) {
var muted = document.getElementById('muted');
var noautoplay = document.getElementById('noautoplay');
var mirrored = document.getElementById('mirrored');
var audio = document.getElementById('audio');
attachMediaStream(stream, muted, {muted: true});
attachMediaStream(stream, noautoplay, {autoplay: false});
attachMediaStream(stream, mirrored, {mirror: true});
attachMediaStream(stream, audio, {audio: true});
document.getElementById('vidContainer').appendChild(attachMediaStream(stream));
})
.catch(function(err) { console.error(err); });
</script>
</body>
</html>