tracking.js
tracking.js copied to clipboard
First example on trackingjs.com simply doesn’t work
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:
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 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.