Created
August 9, 2012 01:34
-
-
Save tiye/3300216 to your computer and use it in GitHub Desktop.
play a mp3 file with buzz continously (need Chrome and buzz, audio API)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html><head><title>Player</title><script src="buzz.js"></script> | |
| <!-- should download "buzz.js" fisrt from "http://buzz.jaysalvat.com/"--> | |
| <script type="text/javascript"> | |
| (function() { | |
| var timer; | |
| window.my = new buzz.sound('xiao.mp3'); | |
| my.play().loop(); | |
| if (localStorage.timer != null) { | |
| timer = Number(localStorage.timer); | |
| timer += 0.2; | |
| my.setTime(timer); | |
| } | |
| my.bind('timeupdate', function(e) { | |
| timer = this.getTime(); | |
| return localStorage.timer = String(timer); | |
| }); | |
| }).call(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| html | |
| head | |
| title Player | |
| script(src='buzz.js') | |
| // should download "buzz.js" fisrt from "http://buzz.jaysalvat.com/" | |
| :coffeescript | |
| window.my = new buzz.sound 'xiao.mp3' | |
| my.play().loop() | |
| if localStorage.timer? | |
| timer = Number localStorage.timer | |
| timer += 0.2 | |
| my.setTime timer | |
| my.bind 'timeupdate', (e) -> | |
| timer = @.getTime() | |
| localStorage.timer = String timer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment