tracking.js icon indicating copy to clipboard operation
tracking.js copied to clipboard

First example on trackingjs.com simply doesn’t work

Open cfcoderatcodefactory opened this issue 4 years ago • 2 comments

Under the title/subheading «Step 2: Choose what you want to play with», this code is supposed to «request your camera and track magenta, cyan and yellow colors that appear in front of it.»

However, nothing happens when I load this page in Firefox or Chrome.

Anyone?

Code:

tracking.js - first tracking

cfcoderatcodefactory avatar May 05 '20 09:05 cfcoderatcodefactory

1:在tracking.js中修改element.src = window.URL.createObjectURL(stream);为element.srcObject = stream;

tracking.initUserMedia_ = function(element, opt_options) { window.navigator.getUserMedia( { video: true, audio: !!(opt_options && opt_options.audio) }, function(stream) { try { //window.URL.createObjectURL(stream)会报错; //element.src = window.URL.createObjectURL(stream); element.srcObject = stream; } catch (err) { element.src = stream; } }, function() { throw Error("Cannot capture user camera."); } ); };

yegdynrs avatar Sep 27 '20 07:09 yegdynrs

@yegdynrs Thank you for your guide.However ,though I have change tracking.js with your advice ,things doesn't become better.The camera still can't work and the page of the first example is blank. I wonder if there anything that i need to do to solve the problem. Looking forward to your reply.

2369257907 avatar Nov 21 '21 07:11 2369257907