forked from mpromonet/webrtc-streamer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webrtcstreamer.html
34 lines (33 loc) · 1.24 KB
/
webrtcstreamer.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
<html>
<head>
<script src="libs/request.min.js" ></script>
<script src="libs/adapter.js" ></script>
<script src="webrtcstreamer.json" ></script>
<script src="webrtcstreamer.js" ></script>
<script>
if (location.search.slice(1)) {
var webRtcServer = new WebRtcStreamer("video", webrtcConfig.url, request);
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>