forked from geelen/x-gif
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudio2.html
73 lines (66 loc) · 1.88 KB
/
audio2.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
<!doctype html>
<html>
<head>
<title>Toggle Button</title>
<script src="../dist/platform.js"></script>
<link rel="import" href="../dist/x-gif.html">
<style>
html, body{
height: 100%;
}
body {
margin: 0;
background-color: white;
}
</style>
</head>
<body unresolved>
<x-gif fill sync></x-gif>
<audio loop>
<source src="cc_audio/encom_part_ii.ogg" type="audio/ogg">
<source src="cc_audio/encom_part_ii.mp3" type="audio/mpeg">
</audio>
<script src="synched_playback.js"></script>
<script>
"use strict";
var synchOffset = -0.1, gifs = [
"http://i.imgur.com/iKXH4E2.gif",
"http://i.imgur.com/RY2vTBQ.gif",
"http://i.imgur.com/YlxOOI7.gif",
"http://i.imgur.com/5KSc0px.gif",
"http://i.imgur.com/m25uYzq.gif",
"http://i.imgur.com/ifR7csn.gif"
];
window.addEventListener('polymer-ready', function (e) {
var xGif = document.querySelector('x-gif'),
audio = document.querySelector('audio'),
metadata,
gifNr = 0;
window.nextGif = function () {
xGif.src = gifs[gifNr++ % gifs.length];
};
var changeGif = function () {
setTimeout(changeGif, 10000);
nextGif();
};
changeGif();
var xhr = new XMLHttpRequest();
xhr.open('GET', 'cc_audio/encom_part_ii.json', true);
xhr.onload = function () {
metadata = JSON.parse(this.response);
setupAudioSynching(audio, xGif, metadata);
audio.play();
}
xhr.send();
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-32408977-5', 'geelen.github.io');
ga('send', 'pageview');
</script>
</body>
</html>