-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.html
90 lines (85 loc) · 2.44 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
86
87
88
89
90
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>videojs-webrtc-plugin Demo</title>
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
<link href="dist/videojs-webrtc-plugin.css" rel="stylesheet">
<style>
.demo-wrapper {
margin: auto;
width: 1000px;
padding: 30px 20px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background: #D3DEDC;
border: 1px solid #92A9BD;
border-radius: 16px;
}
.player-controls {
width: 640px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 24px;
}
.form-input {
width: 640px;
height: 24px;
margin-bottom: 10px;
}
.button {
width: 300px;
height: 30px;
}
.video-js {
width: 640px;
height: 320px;
}
.form-label {
margin-bottom: 6px;
}
</style>
</head>
<body>
<div class="demo-wrapper">
<video id="videojs-webrtc-player" class="video-js vjs-default-skin" controls></video>
<form class="player-controls" id="stream-form">
<label for="streamUrl" class="form-label">WS stream link</label>
<input class="form-input"
type="text"
id="streamUrl"
placeholder="ws://[ant-address]/[app]/[streamId].webrtc"
>
<label for="iceServers" class="form-label">ICE-servers Array (JSON format)</label>
<input class="form-input"
type="text"
id="iceServers"
placeholder="Type iceServers Array" value='[ { "urls": "stun:stun1.l.google.com:19302" } ]'
>
<button class="button" type="submit">Load</button>
</form>
</div>
<script src="node_modules/video.js/dist/video.js"></script>
<script src="dist/videojs-webrtc-plugin.js"></script>
<script>
(function(window, videojs) {
const streamForm = document.getElementById('stream-form')
streamForm.addEventListener('submit', function(event) {
event.preventDefault();
const examplePlayer = window.examplePlayer = videojs('videojs-webrtc-player');
const streamUrl = document.getElementById('streamUrl').value;
const iceServers = document.getElementById('iceServers').value;
examplePlayer.src({
src: streamUrl,
iceServers: iceServers,
})
examplePlayer.play();
});
}(window, window.videojs));
</script>
</body>
</html>