-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_video.html
More file actions
38 lines (30 loc) · 977 Bytes
/
Copy pathbasic_video.html
File metadata and controls
38 lines (30 loc) · 977 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>basic video</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="_css/basic.css" />
<style>
#video{
width: 100%;
}
</style>
</head>
<body>
<video id="video" autoplay></video>
<script>
function hasGetUserMedia() {
return !!(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
}
var onFailSoHard = function(e){
console.log("broken", e);
}
window.URL = window.URL || window.webkitURL;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
var video = document.querySelector('video');
if(navigator.getUserMedia){
navigator.getUserMedia({video: true, audio: true}, function(stream){video.src = window.URL.createObjectURL(stream);}, onFailSoHard);
}
</script>
</body>
</html>