/
index.html
executable file
·53 lines (44 loc) · 1.67 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
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Sync test</title>
<link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
</head>
<body>
<h1>Video.js Sync Example</h1>
<video-js id="player" class="vjs-default-skin" controls preload="auto" width="640" height="268">
<source src="https://cph-msl.akamaized.net/hls/live/2000341/test/master.m3u8" type="application/x-mpegURL">
</video-js>
Current Time: <div id="time"></div><br/>
<div>
<button id="add">+</button>
<button id="sub">-</button>
<button id="resync">Retry Sync</button>
<button id="lock">Done Manual Sync</button>
</div>
<div id="status">
</div>
<script src="https://unpkg.com/video.js/dist/video.js"></script>
<script src="https://unpkg.com/@videojs/http-streaming/dist/videojs-http-streaming.js"></script>
<script src="./iife.index.js"></script>
<script>
const firebaseConfig = {"replace": "me!"};
// Note that this server is not guaranteed to exist. Please provide
// your own if you have problems.
const timeUrl = 'http://localhost:8090/.well-known/time';
player = videojs('player');
liveSync = new sync.LiveVideoSync(
player,
(x) => document.getElementById("status").textContent = x,
timeUrl,
firebaseConfig,
)
document.getElementById("add").addEventListener("click", () => liveSync.nudge(0.2));
document.getElementById("sub").addEventListener("click", () => liveSync.nudge(-0.2));
document.getElementById("resync").addEventListener("click", () => liveSync.resync());
document.getElementById("lock").addEventListener("click", () => liveSync.lockManualSync());
liveSync.start()
</script>
</body>
</html>