From 38f42409a8066f270233a65cb75b28a29a233f9a Mon Sep 17 00:00:00 2001 From: Guillaume DE LA RUE Date: Sun, 13 Feb 2011 14:51:16 +0100 Subject: [PATCH] Try to correct non playing background music on Chrome... --- index.html | 5 ++++- js/main.js | 2 +- js/sounds.load.js | 13 ++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 7e02c22..ac127c9 100644 --- a/index.html +++ b/index.html @@ -73,7 +73,7 @@ @@ -100,6 +100,9 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); + + + diff --git a/js/main.js b/js/main.js index ca16543..6dc90fb 100644 --- a/js/main.js +++ b/js/main.js @@ -30,7 +30,7 @@ jQuery(document).ready(function() { function() { // -- Init Stage or show IE popup - if ( ! $.browser.msie || ( $.browser.version >= 9 ) ) { + if ( ! $.browser.msie || ( $.browser.msie && $.browser.version >= 9 ) ) { Game.init() ; } else { alert('Sorry but this game only works in good navigators. Please download Google Chrome or Firefox' ) ; diff --git a/js/sounds.load.js b/js/sounds.load.js index 51c14c8..5ed812c 100644 --- a/js/sounds.load.js +++ b/js/sounds.load.js @@ -19,14 +19,17 @@ // -- Background Music soundManager.createSound({ id: 'music', - url: '/audio/bg_music.ogg', + url: 'audio/bg_music.ogg', autoLoad: true, autoPlay: false, multiShot: false, volume: 10, loop: true, onload: function() { - this.play() ; + var soundObj = this; + setTimeout(function() { + soundObj.play() ; + }, 1000) ; }, onfinish: function() { this.play(); @@ -36,7 +39,7 @@ // -- Click soundManager.createSound({ id: 'click', - url: '/audio/click.ogg', + url: 'audio/click.ogg', autoLoad: true, autoPlay: false, multiShot: false, @@ -46,7 +49,7 @@ // -- Fire soundManager.createSound({ id: 'shoot', - url: '/audio/big_laser.ogg', + url: 'audio/big_laser.ogg', autoLoad: true, autoPlay: false, multiShot: true, @@ -56,7 +59,7 @@ // -- Explode soundManager.createSound({ id: 'explode', - url: '/audio/explode.ogg', + url: 'audio/explode.ogg', autoLoad: true, autoPlay: false, multiShot: true,