Created
January 16, 2012 17:38
-
-
Save temperatio/1621963 to your computer and use it in GitHub Desktop.
Simple audio javascript play with QuoJS
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>templates</title> | |
<script src="lib/QuoJS.js"></script> | |
<script> | |
$$(document).ready(function() { | |
$$('#pbutton').tap(function(){ | |
var s = $$('#snd').get(0); | |
console.log(s.duration); | |
s.play(); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<header> | |
<h1>templates</h1> | |
</header> | |
<div> | |
<a href="#" id="pbutton">play</a> | |
<audio id="snd"> | |
<source src="sounds/musica.m4a"></source> | |
<source src="sounds/musica.mp3"></source> | |
<source src="sounds/musica.ogg"></source> | |
</audio> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment