Reset audio offset every tick.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Thu, 2 Oct 2014 13:32:20 +0000 (15:32 +0200)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Mon, 6 Oct 2014 22:42:47 +0000 (00:42 +0200)
src/yuu/director.js

index e1c0b538b24230cd19e8a00a301d1e64d4ad0dad..42d891b25deceeb9b6643d8eb57b999e6924bab4 100644 (file)
             this._resized = true;
             var director = this;
             this._rafId = window.requestAnimationFrame(function _ (t) {
-                if (!director._timerStart) {
+                if (!director._timerStart)
                     director._timerStart = t;
-                    director._audioOffset = yuu.audio
-                        ? yuu.audio.currentTime * 1000 - t
-                        : 0;
-                }
                 director._rafId = window.requestAnimationFrame(_);
                 director.render(t);
             });
             /** Tick and render all scenes, bottom to top */
             var i;
 
+            this._audioOffset = yuu.audio
+                ? yuu.audio.currentTime * 1000 - t
+                : 0;
+
             if (this._resized) {
                 this._dispatchSceneInput("resize", [yuu.canvas]);
                 this._resized = false;