-
Notifications
You must be signed in to change notification settings - Fork 1
/
webrtcstream.html
32 lines (31 loc) · 1.11 KB
/
webrtcstream.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
<html>
<head>
<script src="ajax.js" ></script>
<script src="webrtcstreamer.js" ></script>
<script>
if (location.search.slice(1)) {
var webRtcServer = new WebRtcStreamer("video");
var url = { video:location.search.slice(1) };
var options;
if (typeof URLSearchParams != 'undefined') {
var params = new URLSearchParams(location.search.slice(1));
if (params.has("video") || params.has("audio")) {
url = { video:params.get("video"), audio:params.get("audio") };
}
options = params.get("options");
}
window.onload = function() { webRtcServer.connect(url.video,url.audio,options) }
window.onbeforeunload = function() { webRtcServer.disconnect() }
} else {
if (typeof URLSearchParams != 'undefined') {
alert("WebRTC stream name to connect is missing\n\nUsage :" + window.location + "?video=<WebRTC video stream name>&audio=<WebRTC audio stream name>&options=<WebRTC options>")
} else {
alert("WebRTC stream name to connect is missing\n\nUsage :" + window.location + "?<WebRTC video stream name>")
}
}
</script>
</head>
<body>
<video id="video" />
</body>
</html>