summaryrefslogtreecommitdiffstats
path: root/webapp/app/static/music.html
diff options
context:
space:
mode:
authorAaron Perley <aaron.perley@gmail.com>2016-10-17 14:54:06 -0400
committerAaron Perley <aaron.perley@gmail.com>2016-10-17 14:54:06 -0400
commit1b0d46151bb6e0d98787fa1cdcc3b5b80b7d2478 (patch)
tree6653e7e6614eb14fa6dea4e3b90b922275903a63 /webapp/app/static/music.html
parentMake fish enable/disable state more robust (diff)
downloadbridge-1b0d46151bb6e0d98787fa1cdcc3b5b80b7d2478.tar.zst
Add sound effects
Diffstat (limited to 'webapp/app/static/music.html')
-rw-r--r--webapp/app/static/music.html106
1 files changed, 106 insertions, 0 deletions
diff --git a/webapp/app/static/music.html b/webapp/app/static/music.html
new file mode 100644
index 0000000..154e519
--- /dev/null
+++ b/webapp/app/static/music.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ </head>
+ <body>
+ <audio id="ocean_waves" controls loop>
+ <source src="/static/ocean_waves.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="seashore" controls loop>
+ <source src="/static/seashore.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="underwater" controls loop>
+ <source src="/static/underwater.mp3" type="audio/mpeg">
+ </audio>
+
+
+ <audio id="jellyfish" controls>
+ <source src="/static/jellyfish.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="dolphin" controls>
+ <source src="/static/dolphin.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="boat" controls>
+ <source src="/static/boat.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="nemo" controls>
+ <source src="/static/nemo.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="dory" controls>
+ <source src="/static/dory.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="whale" controls>
+ <source src="/static/whale.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="eel" controls>
+ <source src="/static/eel.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="stingray" controls>
+ <source src="/static/stingray.mp3" type="audio/mpeg">
+ </audio>
+
+ <audio id="shark" controls>
+ <source src="/static/shark.mp3" type="audio/mpeg">
+ </audio>
+
+ <script type="text/javascript" src="//code.jquery.com/jquery-2.1.4.min.js"></script>
+ <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.5/socket.io.min.js"></script>
+
+ <script>
+ var currently_playing = undefined;
+ function playBackground(id) {
+ new_playing = document.getElementById(id)
+ if( !new_playing ) {
+ return;
+ }
+
+ if (currently_playing && currently_playing != new_playing) {
+ currently_playing.pause();
+ }
+ currently_playing = new_playing;
+ currently_playing.play();
+ }
+
+ function playEffect(id) {
+ document.getElementById(id).play();
+ }
+
+ $(document).ready(function() {
+ var namespace = '/music';
+ socket = io.connect('http://' + document.domain + ':' + location.port + namespace);
+
+ socket.on('connect', function() {
+ console.log('connected!');
+ });
+
+ socket.on('disconnect', function() {
+ console.log('disconnected');
+ });
+
+
+ socket.on('background', function(msg) {
+ console.log('background', msg);
+ playBackground(msg.id);
+ });
+
+ socket.on('effect', function(msg) {
+ playEffect(msg.id);
+ });
+
+ socket.emit('ready');
+ setInterval(function() {
+ socket.emit('ready');
+ }, 5000);
+ });
+ </script>
+ </body>
+</html>