Created
November 23, 2010 11:34
-
-
Save drewlesueur/711632 to your computer and use it in GitHub Desktop.
example coffeescript for iphone audio tag
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
$(document).ready () -> | |
#alert screen.height | |
audioElement = document.createElement('audio'); | |
audioElement.setAttribute 'src', 'audio/star_good.m4a' | |
audioElement.addEventListener 'canplay', () -> | |
alert 'canplay' | |
audioElement.controls = false | |
document.body.appendChild audioElement | |
audioElement.oncanplay = () -> | |
console.log "can play" | |
$(audioElement).bind 'oncanplaythrough' , () -> | |
console.log "canplay thru" | |
audioElement.load(); | |
audioElement.play(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment