From 31d7c13b8e02f6d4218cd5477e8229ec4cb0d427 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Thu, 2 Oct 2014 15:32:20 +0200 Subject: [PATCH] Reset audio offset every tick. --- src/yuu/director.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/yuu/director.js b/src/yuu/director.js index 385a3e7..14524f2 100644 --- a/src/yuu/director.js +++ b/src/yuu/director.js @@ -304,12 +304,8 @@ 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); }); @@ -385,6 +381,10 @@ /** 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; -- 2.20.1