From b44398b4caa83adaa39a9020d7cf8e64154a5a74 Mon Sep 17 00:00:00 2001 From: rajbot Date: Wed, 22 Jun 2011 22:50:06 +0000 Subject: [PATCH] workaround buggy soundManger2 callbacks on FF5 and IE9 --- BookReader/BookReader.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/BookReader/BookReader.js b/BookReader/BookReader.js index de9ed07..624d826 100644 --- a/BookReader/BookReader.js +++ b/BookReader/BookReader.js @@ -4817,15 +4817,17 @@ BookReader.prototype.ttsStartCB = function (data) { this.showProgressPopup('Loading audio...'); - ///// whileloading: broken on safari - ///// onload fires on safari, but *after* the sound starts playing.. + ///// Many soundManger2 callbacks are broken when using HTML5 audio. + ///// whileloading: broken on safari, worked in FF4, but broken on FireFox 5 + ///// onload: fires on safari, but *after* the sound starts playing, and does not fire in FF or IE9 + ///// onbufferchange: fires in FF5 using HTML5 audio, but not in safari using flash audio + ///// whileplaying: fires everywhere this.ttsPosition = -1; var snd = soundManager.createSound({ id: 'chunk'+this.ttsIndex+'-0', - //url: 'http://home.us.archive.org/~rkumar/arctic.ogg', url: 'http://'+this.server+'/BookReader/BookReaderGetTTS.php?string=' + escape(data[0][0]) + '&format=.'+this.ttsFormat, //the .ogg is to trick SoundManager2 to use the HTML5 audio player - whileloading: function(){if (this.bytesLoaded == this.bytesTotal) this.br.removeProgressPopup();}, //onload never fires in FF... - onload: function(){this.br.removeProgressPopup();} //whileloading never fires in safari... + onload: function(){this.br.removeProgressPopup();}, //fires in safari... + onbufferchange: function(){if (false == this.isBuffering) this.br.removeProgressPopup();} //fires in FF and IE9 }); snd.br = this; snd.load(); -- 2.20.1