Skip to content

Commit

Permalink
Replaced setTimeout with setInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
idevelop committed Feb 26, 2013
1 parent 7dab84c commit 3e803a2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions script/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,16 @@ var camera = (function() {
context.scale(-1, 1);
}

var drawInterval = Math.round(1000 / options.fps);
var draw = function() {
video.play();

setInterval(function() {
try {
context.drawImage(video, 0, 0, video.width, video.height);
options.onFrame(canvas);
} catch (e) { }

setTimeout(draw, drawInterval);
};

video.play();
draw();
} catch (e) {
// TODO
}
}, Math.round(1000 / options.fps));
}

return {
Expand Down

0 comments on commit 3e803a2

Please sign in to comment.