-
Notifications
You must be signed in to change notification settings - Fork 0
/
video.html
42 lines (38 loc) · 1.46 KB
/
video.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
42
<html>
<head>
<title>Video element getUserMedia mock - DEMO</title>
<script type="module">
import GetUserMediaMock from './index.js'
window.addEventListener('load', function(){
setup();
testGetUserMedia();
});
function setup(){
window.getUserMediaMock = new GetUserMediaMock();
getUserMediaMock.setMediaUrl(getUserMediaMock.DEFAULT_MEDIA.VIDEO)
.setMockType('mediaElement')
.mock();
}
function testGetUserMedia(){
// navigator.getUserMedia({video: true}, function(stream){ // Not used anymore.
navigator.getUserMedia({video: true})
.then(function(stream){
const video = document.createElement('video');
video.autoplay = true;
video.srcObject = stream;
document.getElementById('stream-wrapper').appendChild(video);
}).catch(console.error);
}
</script>
</head>
<body>
<h1>Video element getUserMedia mock - DEMO</h1>
<div>
This page automatically tries to load getUserMedia with a predefined video element as the source.
Make sure to use secure page(localhost, https).
</div>
<div id="stream-wrapper">
<!-- STREAM ADDDED HERE -->
</div>
</body>
</html>