<div id="hiddencontents"><!-- $hiddenContents --></div>
<div id="splash"><!-- $splash --></div>
<div id="popinOverlay"></div>
+<audio src="sound/empty.mp3" id="pagesaudio" preload="auto"></audio>
<!-- $statsfooter -->
</body>
</html>
\ No newline at end of file
this.enabled = true;
this.on = !!this.fluidbook.datas.soundOn;
- this.audios = [];
+ this.audio = $("#pagesaudio").get(0);
this.initEvents();
}
$(this.fluidbook).on('fluidbook.page.change.start', function (e, page, data) {
$this.playSoundForPage(data);
});
+
+ $(document).one('click', '*', function () {
+ $this.audio.src = 'sound/empty.mp3';
+ $this.audio.volume = 1;
+ try {
+ $this.audio.play();
+ } catch (e) {
+ }
+ return true;
+ });
},
init: function () {
sound = 'page-flip-' + (Math.round(Math.random() + 1));
}
- var audio = new Audio('data/sounds/' + sound + '.mp3');
- audio.volume = 1;
- audio.play();
+ this.audio.src = 'data/sounds/' + sound + '.mp3';
+ this.audio.volume = 1;
+ try {
+ this.audio.play();
+ } catch (e) {
- this.audios.push(audio);
+ }
},
stopAllSounds: function () {
- $.each(this.audios, function (k, audio) {
- try {
- audio.pause();
- } catch (err) {
+ try {
+ this.audio.pause();
+ } catch (e) {
- }
- audio = null;
- });
- this.audios = [];
+ }
},
};
\ No newline at end of file