]> _ Git - fluidbook-html5.git/commitdiff
wip #2342 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 14 Nov 2018 11:04:29 +0000 (12:04 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 14 Nov 2018 11:04:29 +0000 (12:04 +0100)
js/libs/fluidbook/fluidbook.sound.js

index ee76dcf211a08f070ac65142e5f6b576d83f0da5..8d0daa7d29fe941454e343d42df96d98af59d599 100644 (file)
@@ -84,7 +84,6 @@ FluidbookSound.prototype = {
         this.on = false;
         $(".icon-sound-on").hide();
         $(".icon-sound-off").show();
-        this.stopAllSounds();
     },
 
     playSoundForPage: function (data) {
@@ -92,7 +91,6 @@ FluidbookSound.prototype = {
             return;
         }
 
-        this.stopAllSounds();
 
         var page = data.page;
         if (page % 2 === 1) {
@@ -110,23 +108,14 @@ FluidbookSound.prototype = {
         } else {
             sound = 'page-flip-' + (Math.round(Math.random() + 1));
         }
+
+        console.log(sound);
         try {
             this.audios[sound].volume = 1;
+            this.audios[sound].fastSeek(0);
             this.audios[sound].play();
-            this.playing = this.audios[sound];
         } catch (e) {
             console.log(e);
         }
     },
-
-    stopAllSounds: function () {
-        try {
-            if (this.playing !== null) {
-                this.playing.pause();
-                this.playing = null;
-            }
-        } catch (e) {
-
-        }
-    },
 };
\ No newline at end of file