Skip to content

Commit

Permalink
Bug 738008: Disable music playback on Safari. Disable audio on Safari…
Browse files Browse the repository at this point in the history
… Windows.
  • Loading branch information
sork committed Mar 23, 2012
1 parent e0ab40c commit fdd42db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 8 additions & 11 deletions client/js/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ define(['area'], function(Area) {
_.each(self.soundNames, function(name) { self.loadSound(name, function() {
counter -= 1;
if(counter === 0) {
loadMusicFiles();
if(!Detect.isSafari()) { // Disable music on Safari - See bug 738008
loadMusicFiles();
}
}
});
});
Expand All @@ -39,7 +41,11 @@ define(['area'], function(Area) {
}
};

loadSoundFiles();
if(!(Detect.isSafari() && Detect.isWindows())) {
loadSoundFiles();
} else {
this.enabled = false; // Disable audio on Safari Windows
}
},

toggle: function() {
Expand Down Expand Up @@ -98,15 +104,6 @@ define(['area'], function(Area) {
music.addEventListener('ended', function() { music.play() }, false);
},

/*
isLoaded: function() {
var self = this;
if(_.any(this.musicNames, function(name) { return !_.include(_.keys(self.sounds), name) })) {
return false;
}
return true;
},*/

getSound: function(name) {
if(!this.sounds[name]) {
return null;
Expand Down
4 changes: 4 additions & 0 deletions client/js/detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ Detect.isChromeOnWindows = function() {
Detect.canPlayMP3 = function() {
return Modernizr.audio.mp3;
};

Detect.isSafari = function() {
return Detect.userAgentContains('Safari') && !Detect.userAgentContains('Chrome');
};

0 comments on commit fdd42db

Please sign in to comment.