From 132006b79d922f06d95a162dd398416792b0c578 Mon Sep 17 00:00:00 2001 From: Anuj Panchal Date: Wed, 16 Aug 2017 10:26:48 +0530 Subject: [PATCH] Update main.js Changed setInterval to requestAnimationFrame --- app/scripts/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/scripts/main.js b/app/scripts/main.js index 5751536c0..496702735 100644 --- a/app/scripts/main.js +++ b/app/scripts/main.js @@ -191,6 +191,7 @@ if(self.onframe) self.onframe(); coordinatesHaveChanged = false; + requestAnimationFrame(captureFrame); }; var getCamera = function(videoSource, cb) { @@ -221,7 +222,7 @@ var isSetup = setupVariables(e); if(isSetup) { - setInterval(captureFrame.bind(self), 4); + requestAnimationFrame(captureFrame.bind(self)); } else { // This is just to get around the fact that the videoWidth is not @@ -229,7 +230,7 @@ setTimeout(function() { setupVariables(e); - setInterval(captureFrame.bind(self), 4); + requestAnimationFrame(captureFrame.bind(self)); }, 100); }