Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 738008: Disable music playback on Safari. Disable audio on Safari…

… Windows.
  • Loading branch information...
commit fdd42dba5e2437eb6f486f2035b15d7e0d011657 1 parent e0ab40c
@sork sork authored
Showing with 12 additions and 11 deletions.
  1. +8 −11 client/js/audio.js
  2. +4 −0 client/js/detect.js
View
19 client/js/audio.js
@@ -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();
+ }
}
});
});
@@ -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() {
@@ -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;
View
4 client/js/detect.js
@@ -30,3 +30,7 @@ Detect.isChromeOnWindows = function() {
Detect.canPlayMP3 = function() {
return Modernizr.audio.mp3;
};
+
+Detect.isSafari = function() {
+ return Detect.userAgentContains('Safari') && !Detect.userAgentContains('Chrome');
+};
Please sign in to comment.
Something went wrong with that request. Please try again.