tracking.js
tracking.js copied to clipboard
video demos on the website can't run
First, thanks for the awesome lib!
In my device, any demo on the website which use video tag can't run correctly.
device info: macOs/10.14.6 Chrome/76.0.3809.87
And, I found some info in MDN. According to it, I rewrite tracking.initUserMedia_.
tracking.initUserMedia_ = function(element, opt_options) {
// window.navigator.getUserMedia(
// {
// video: true,
// audio: !!(opt_options && opt_options.audio)
// },
// function(stream) {
// try {
// element.src = window.URL.createObjectURL(stream);
// } catch (err) {
// element.src = stream;
// }
// },
// function() {
// throw Error("Cannot capture user camera.");
// }
// );
window.navigator.mediaDevices
.getUserMedia({
video: true,
audio: !!(opt_options && opt_options.audio)
})
.then(stream => {
element.srcObject = stream;
video.onloadedmetadata = function(e) {
element.play();
};
})
.catch(err => {
throw Error("Cannot capture user camera.", err);
});
};
Then, the demos works!
Running into same issue, seems like bower is changing element.srcObject to element.src. Digging to find a fix for this.