-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
69 lines (59 loc) · 1.97 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
<!doctype html>
<html>
<head>
<title>Picam Viewer</title>
<link rel="stylesheet" href="vendor/video-js.min.css">
<style type="text/css">
body {
background: black;
text-align: center;
}
#player {
margin: 0 auto;
}
</style>
</head>
<body>
<video id="player" preload="auto" controls class="video-js vjs-default-skin"></video>
<script src="vendor/promise.min.js"></script>
<script src="vendor/fetch.js"></script>
<script src="vendor/video.min.js"></script>
<script src="vendor/videojs-flash.min.js"></script>
<script src="vendor/videojs-contrib-hls.min.js"></script>
<script type="text/javascript">
fetch('config.json').then(function (response) {
return response.json();
}).then(function (config) {
var streamUrl = config.url;
// build absolute url
if (streamUrl.indexOf('http://') < 0 && streamUrl.indexOf('https://') < 0) {
if (streamUrl.indexOf('/') === 0) {
streamUrl = location.pathname + streamUrl;
} else if (streamUrl.indexOf('/') === 1) {
streamUrl = streamUrl.substr(1);
}
streamUrl = location.protocol
+ '//'
+ location.hostname
+ (location.port ? ':' + location.port : '')
+ '/'
+ streamUrl;
}
var parameters = {
sources: [
{
src: streamUrl,
type: 'application/x-mpegURL'
}
],
aspectRatio: "16:9",
fluid: true,
techOrder: ['html5', 'flash']
};
// Configure videojs
var player = videojs('player', parameters);
player.play();
});
</script>
</body>
</html>