Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,10 @@
// it seems all handled in the tracking.TrackerTask..
// so in short, remove the tracking.TrackerTask from here
// if the user want to use it, it can create it himself
var requestId;
var stopRequestAnimationFrame = false;
var requestAnimationFrame_ = function() {
requestId = window.requestAnimationFrame(function() {
window.requestAnimationFrame(function() {
if (stopRequestAnimationFrame) return;
if (element.readyState === element.HAVE_ENOUGH_DATA) {
try {
// Firefox v~30.0 gets confused with the video readyState firing an
Expand All @@ -263,7 +264,7 @@

var task = new tracking.TrackerTask(tracker);
task.on('stop', function() {
window.cancelAnimationFrame(requestId);
stopRequestAnimationFrame = true;
});
task.on('run', function() {
requestAnimationFrame_();
Expand Down