forked from mozilla/webrtc-landing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pc_test_no_h264.html
56 lines (43 loc) · 1.2 KB
/
pc_test_no_h264.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
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Simple WebRTC H264 verification page</title>
</head>
<body>
<h1>Simple WebRTC H264 check page</h1>
<div>
<button id="tehbutton" onclick="start();">Test!</button>
</div>
<div id="log"></div>
<script type="application/javascript">
function log(msg) {
let div = document.getElementById("log");
div.innerHTML = div.innerHTML + "<p>" + msg + "</p>";
}
let button = document.getElementById("tehbutton");
let pc1;
function failed(code) {
var err = code.message || code;
console.log(err);
log("Failure callback: " + JSON.stringify(err));
}
// replace CR NL with HTML breaks
function sdpPrettyPrint(sdp) {
return sdp.replace(/[\r\n]+/g, '<br>');
}
function start() {
pc1 = new RTCPeerConnection({});
pc1.createOffer({ offerToReceiveVideo: true })
.then((offer) => {
if (offer.sdp.search(/rtpmap:([0-9]+) H264/g) != -1) {
log("<b>YES H.264 is supported!\r\n</b>");
} else {
log("<b>H.264 is NOT supported!\r\n</b>");
}
//log(sdpPrettyPrint(offer.sdp));
})
.catch((e) => {
failed(e);
});
}
</script>
</body></html>