Skip to content

Instantly share code, notes, and snippets.

@temperatio
Created January 16, 2012 17:38
Show Gist options
  • Save temperatio/1621963 to your computer and use it in GitHub Desktop.
Save temperatio/1621963 to your computer and use it in GitHub Desktop.
Simple audio javascript play with QuoJS
<!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