forked from Miserlou/browser-waveform
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathwaveform.html
More file actions
34 lines (29 loc) · 754 Bytes
/
waveform.html
File metadata and controls
34 lines (29 loc) · 754 Bytes
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
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="waveform-chrome.js"></script>
<canvas id="canvas" width="800" height="300"></canvas>
<div id="status"></div>
<div id="play"><button type="button">Play / Pause</div>
<style>
canvas { border: solid 1px black }
</style>
<script>
$(function() {
var sound = Waveform({
file: 'src.ogg',
canvas: $('#canvas'),
onStatus: function(x) {
$('#status').text('Loading '+Math.floor(x*100)+'%')
},
onReady: function() {
$('#status').text('Done')
}
})
$('#play').click(function() {
if(sound.playback.isPaused())
sound.playback.play()
else
sound.playback.pause();
})
})
</script>
<p>Works in Chrome</p>