-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
85 lines (73 loc) · 2.05 KB
/
index.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>getUserMedia Test</title>
<script type="text/javascript" src="js/adapter.js"></script>
<script type="text/javascript" src="js/getusermedia.js"></script>
<style type="text/css">
.error {
font-weight: bold;
}
.red {
color: red ;
}
.green {
color: green ;
}
.blue {
color : blue;
}
</style>
</head>
<body>
<h1>getUserMedia Test</h1>
<div><input id="chkAudio" type="checkbox" checked="checked"> Audio</div>
<div><input id="chkVideo" type="checkbox" checked="checked"> Video</div>
<button onclick="doGUM()">Call getUserMedia</button>
<div id="divResults" style="display: none;">
<span>Audio : </span><span id="txtAudio"></span>
<span>Video : </span><span id="txtVideo"></span>
</div>
<div id="divError" class="error" style="display: none;">
<span>Error : </span><span id="errText" class="red"></span>
</div>
<script type="text/javascript">
var divError = document.getElementById('divError') ;
var txtError = document.getElementById('errText') ;
var chkAudio = document.getElementById('chkAudio') ;
var chkVideo = document.getElementById('chkVideo') ;
var txtAudio = document.getElementById('txtAudio') ;
var txtVideo = document.getElementById('txtVideo') ;
function show(elem) {
elem.style.display='block' ;
}
function hide(elem) {
elem.style.display='none' ;
}
function setResultText(elem, value) {
elem.className=value?'green':'blue' ;
elem.innerHTML=value?'YES':'NO' ;
}
function doGUM() {
hide(divError) ;
hide(divResults) ;
divError.style.display='none' ;
openrmc.webrtc.api.getUserMedia({
audio: chkAudio.checked,
video : chkVideo.checked,
success : function(cxt) {
setResultText(txtAudio, cxt.isrtcaudioavailable()) ;
setResultText(txtVideo, cxt.isrtcvideoavailable()) ;
show(divResults) ;
},
failure : function(cxt) {
console.log('Error - ' + cxt.getError()) ;
txtError.innerHTML=cxt.getError() ;
show(divError) ;
}
}) ;
}
</script>
</body>
</html>