Reset audio offset every tick.
[pwl6.git] / src / yuu / director.js
index cdba62c..7f90fd4 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;