forked from padenot/popathon-2
/
pancarte-player.html
51 lines (50 loc) · 1.27 KB
/
pancarte-player.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
<!doctype html>
<html>
<head>
<title>pancarte.js player</title>
<meta charset=utf-8>
<script src="raphael-min.js"></script>
<script src="pancarte.js"></script>
<script src="timecode.js"></script>
<script src="journal.js"></script>
<link rel="stylesheet" type="text/css" href="shared.css">
</head>
<body>
<video></video>
<button id="play"> Play </button>
<button id="pause"> Pause </button>
<script>
window.addEventListener("load", function() {
var url = prompt("URL of the video?");
var v = document.querySelector("video");
var fps = 0;
var player = null;
v.addEventListener("loadedmetadata", function() {
points = prompt("Paste the points here!");
try {
var timecode = journal_pts;// JSON.parse(points);
console.log(timecode);
player = new PancartePlayer(timecode, v, function() {
// player.pause();
alert("ALLLO");
});
} catch(e) {
alert("invalid json !");
// hack retrigger the prompt
v.src = url;
}
});
v.src = url;
v.addEventListener("error", function() {
url = prompt("Error, correct URL of the video?");
});
document.getElementById("play").onclick = function () {
player.play();
}
document.getElementById("pause").onclick = function () {
player.pause();
}
});
</script>
</body>
</html>