Permalink
Browse files

added mp3s

  • Loading branch information...
1 parent 7e9ad8f commit 5e790bf805f48b743dd82de47f899ab4784f6083 @daleharvey committed Jul 27, 2010
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
@@ -38,11 +38,10 @@
Code on <a href="http://arandomurl.com/">Github</a>
<div id="pacman"></div>
-
- <!-- <script src="pacman_util.js"></script> -->
<script src="pacman.js"></script>
<script>
+
var el = document.getElementById("pacman");
function supports_canvas() {
@@ -53,7 +52,14 @@
return ('localStorage' in window) && window['localStorage'] !== null;
};
- if (supports_canvas() && supports_local_storage()) {
+ function supports_audio() {
+ var myAudio = document.createElement('audio');
+ var canPlayOGG = !!(myAudio.canPlayType('audio/ogg').replace(/no/, ''));
+ var canPlayMP3 = !!(myAudio.canPlayType('audio/mpeg').replace(/no/, ''));
+ return canPlayOgg || canPlayMP3;
+ };
+
+ if (supports_canvas() && supports_local_storage() && supports_audio()) {
window.setTimeout(function () { PACMAN.init(el, "./"); }, 0);
} else {
el.innerHTML = "Sorry, needs a decent browser<br /><small>" +
View
@@ -1197,9 +1197,10 @@ var PACMAN = (function () {
map.draw(ctx);
dialog("Loading ...");
- var audio = document.createElement('audio');
- var canPlayOGG = !!(audio.canPlayType('audio/ogg').replace(/no/, ''));
- var canPlayMP3 = !!(audio.canPlayType('audio/mpeg').replace(/no/, ''));
+ var myAudio = document.createElement('audio');
+ var canPlayOGG = !!(myAudio.canPlayType('audio/ogg').replace(/no/, ''));
+ var canPlayMP3 = !!(myAudio.canPlayType('audio/mpeg').replace(/no/, ''));
+
if (!canPlayOGG || !canPlayMP3) {
// hammer time.
}

0 comments on commit 5e790bf

Please sign in to comment.