]> _ Git - fluidbook-html5.git/commitdiff
wip #6648 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 23 Jan 2024 10:11:32 +0000 (11:11 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 23 Jan 2024 10:11:32 +0000 (11:11 +0100)
js/libs/fluidbook/fluidbook.sound.js

index db850437adb6f6bcb10d44ad16a1afe7a6a6e731..4571a2d8edda95eb52cc717b5e16b9d70565ce64 100644 (file)
@@ -1,9 +1,13 @@
 function FluidbookSound(fluidbook) {
     this.fluidbook = fluidbook;
 
-    this.ambientEnabled = false;
+    if (!Modernizr.audio || this.fluidbook.support.iOS || this.fluidbook.support.android) {
+        this.ambientEnabled = this.enabled = this.on = false;
+        return;
+    }
 
-    if (this.fluidbook.settings.soundTheme === 'none' || this.fluidbook.settings.soundTheme == '' || !Modernizr.audio || this.fluidbook.support.iOS || this.fluidbook.support.android) {
+    this.ambientEnabled = false;
+    if (this.fluidbook.settings.soundTheme === 'none' || this.fluidbook.settings.soundTheme == '') {
         this.enabled = false;
         this.on = false;
     }
@@ -74,6 +78,9 @@ FluidbookSound.prototype = {
     },
 
     preloadSounds: function () {
+        if (!this.enabled) {
+            return;
+        }
         var sounds;
         if (this.simpleTheme) {
             sounds = ['empty', 'flip'];