-
Notifications
You must be signed in to change notification settings - Fork 2
/
tests.html
159 lines (154 loc) · 6.7 KB
/
tests.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!doctype html>
<html lang="en">
<head>
<title>Browser Test page</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
</head>
<body>
<h1 id="title" class="text-center">Browser Test Page</h1>
<h3 id="useragent"></h3>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<div class="card">
<h4 class="card-header">Tests for browser features</h4>
<div class="card-body">
<h4 class="card-title">Test for features we need</h4>
<ul class="list-group card-text">
<li class="list-group-item d-flex justify-content-between align-items-center">Has PeerConnection<span
id="hasPeerConnection" class="badge badge-primary badge-pill">?</span></li>
<li class="list-group-item d-flex justify-content-between align-items-center">Has AudioContext<span
id="hasAudioContext" class="badge badge-primary badge-pill">?</span></li>
<li class="list-group-item d-flex justify-content-between align-items-center">Has generateCertificate <span
id="hasGenerateCertificate" class="badge badge-primary badge-pill">?</span></li>
<li class="list-group-item d-flex justify-content-between align-items-center">Has AudioProcessingNode<span
id="hasAudioProcessing" class="badge badge-primary badge-pill">?</span></li>
<li class="list-group-item d-flex justify-content-between align-items-center">Has WebRTCDataChannel<span
id="hasWebRTCDataChannel" class="badge badge-primary badge-pill">?</span></li>
<li class="list-group-item d-flex justify-content-between align-items-center">Has GetUserMedia<span
id="hasGetUserMedia" class="badge badge-primary badge-pill">?</span></li>
<li class="list-group-item d-flex justify-content-between align-items-center">Has
MediaStreamDestination<span id="hasMediaStreamDestination"
class="badge badge-primary badge-pill">?</span></li>
<li class="list-group-item d-flex justify-content-between align-items-center">Has MediaStreamSource<span
id="hasMediaStreamSource" class="badge badge-primary badge-pill">?</span></li>
<li class="list-group-item d-flex justify-content-between align-items-center">Has Sha265<span id="hasSha265"
class="badge badge-primary badge-pill">?</span>
</li>
</ul>
</div>
</div>
<script>
var ac = null;
function setTag(tag,val){
if (val) {
if (val.name){
tag.text(val.name);
} else {
tag.text("Yes");
}
} else {
tag.text("No");
}
}
function hasGetUserMedia(){
var tag = $("#hasGetUserMedia");
var val = false;
if (navigator.mediaDevices){
if (navigator.mediaDevices.getUserMedia){
val = {name:"mediaDevices.getUserMedia"};
}
} else {
if (navigator.getUserMedia){
val = {name:".getUserMedia"};
}
}
setTag(tag,val);
}
function hasPeerConnection(){
var tag = $("#hasPeerConnection");
var val = (window.RTCPeerConnection || false) ;
setTag(tag,val);
}
function hasAudioContext(){
var tag = $("#hasAudioContext");
var val = (window.AudioContext)|| (window.webkitAudioContext) || false;
setTag(tag,val);
}
function hasGenerateCertificate(){
var tag = $("#hasGenerateCertificate");
var val = (window.RTCPeerConnection) && (window.RTCPeerConnection.generateCertificate);
setTag(tag,val);
}
function hasAudioProcessing(){
var tag = $("#hasAudioProcessing");
var val = (window.AudioContext) || false;
if (val) {
ac = new AudioContext();
} else if (window.webkitAudioContext){
ac = new webkitAudioContext();
}
if (ac != null){
val = ac.createScriptProcessor || window.AudioWorkletNode;
}
setTag(tag,val);
}
function hasMediaStreamSource(){
var tag = $("#hasMediaStreamSource");
var val = false;
if (ac != null){
val = ac.createMediaStreamSource;
}
setTag(tag,val);
}
function hasMediaStreamDestination(){
var tag = $("#hasMediaStreamDestination");
var val = false;
if (ac != null){
val = ac.createMediaStreamDestination;
}
setTag(tag,val);
}
function hasWebRTCDataChannel(){
var tag = $("#hasWebRTCDataChannel");
var val = false ;
if (window.RTCPeerConnection){
var dc = new RTCPeerConnection();
val = dc.createDataChannel || false;
}
setTag(tag,val);
}
function hasSha265(){
var tag = $("#hasSha265");
var val = (window.crypto) || crypto.subtle || crypto.subtle.digest || false;
if (val) {
var method ="SHA-256";
var buffer = new TextEncoder("utf-8").encode(method);
crypto.subtle.digest(method, buffer).then(function (hash) {
setTag(tag,{name:method});
}).catch(function(why) { setTag(tag,{name:why})});
} else {
setTag(tag,val);
}
}
$( document ).ready(function() {
$("#useragent").text(navigator.userAgent);
hasPeerConnection();
hasAudioContext();
hasGetUserMedia();
hasGenerateCertificate();
hasAudioProcessing();
hasWebRTCDataChannel();
hasMediaStreamSource();
hasMediaStreamDestination();
hasSha265();
});
</script>
</body>
</html>