-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
90 lines (81 loc) · 2.69 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"/>
<link href="http://fonts.googleapis.com/css?family=Open+Sans:regular,semibold,italic,italicsemibold|PT+Sans:400,700,400italic,700italic|PT+Serif:400,700,400italic,700italic" rel="stylesheet" />
<link href="css/journey-demo.css" rel="stylesheet" />
</head>
<body>
<div id="loading">
<p>Please wait while the page is loading... <small>(if it takes a long time, try again in Chrome)</small></p>
</div>
<div id="hint">
<p>Please use the headphone, since there will be music. Use spacebar to start or pause/resume</p>
</div>
<div id="journey">
<audio id="journey-audio" src="resources/bbb.mp3" data-length="3:36"></audio>
<div class="journey-slide text-slide" data-duration="4">
<p class="journey-p">
Are you tired about slides with only text and pictures?
</p>
</div>
<div class="journey-slide text-slide" data-duration="3">
<p class="journey-p">
Won't it be great if you can do presentation in your browser with audio?
</p>
</div>
<div class="journey-slide">
<img class="journey-img" src="resources/pic.jpg"/>
<p class="annotation">picture annotation</p>
</div>
</div>
<script src="js/journey.js"></script>
<script src="js/jquery-1.11.1.min.js"></script>
<script>
var not_supported = false;
var init = function() {
if (not_supported) {
return;
}
try {
journey.init();
} catch (e) {
console.log('Failed init due to exception: ' + e);
console.log('Message: ' + e.message);
if (e.name == "InvalidStateError") {
console.log("Audio metadata is not loaded. Will retry init later");
return;
} else {
$('#loading')[0].innerHTML = "You browser is not supported. Please try again with Chrome 35+, Firefox 29+, Safari 6+ or IE 11.";
not_supported = true;
return;
}
}
var is_playing = false;
var is_paused = false;
var key_down = function(e) {
if (e.keyCode === 32) {
$('#hint')[0].style['display'] = 'none';
if (!is_playing && !is_paused) {
is_playing = true;
journey.play();
} else if (is_playing && !is_paused) {
is_paused = true;
journey.pause();
} else if (is_playing && is_paused) {
is_paused = false;
journey.resume();
}
}
};
window.onkeydown = key_down;
//initialization finished
$('#loading')[0].style['display'] = 'none';
$('#hint')[0].style['display'] = 'block';
}
//call init twice to make sure that when it's called the second time, it will be in good state
$(document).ready(init);
$('#journey-audio')[0].addEventListener('loadedmetadata', init);
</script>
</body>
</html>