Skip to content

Instantly share code, notes, and snippets.

@connerbrooks
Created March 27, 2014 20:58
Show Gist options
  • Save connerbrooks/9818581 to your computer and use it in GitHub Desktop.
Save connerbrooks/9818581 to your computer and use it in GitHub Desktop.
[wearscript] Audio Example HTML5
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<!-- audio from HTML5 -->
<audio autoplay="autoplay" loop>
<source src="http://mean2u.rfshq.com/downloads/music/battletheme.mp3" type="audio/mpeg"/>
</audio>
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function server() {
WS.log('Audio Test');
WS.say('Audio Test');
}
function main() {
if (WS.scriptVersion(1)) return;
ctx = document.getElementById('canvas').getContext("2d");
WS.serverConnect('{{WSUrl}}', server);
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment