I am creating chrome extension which shows the camera on current page when I click on the extension icon. The camera code separately in index html works well, but when I am trying to use it in chrome extension it shows me error: "A cookie associated with a cross-site resource at was set without the SameSite attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at and .", it seems that my camera light is switched on but there is not camera anywhere, can someone help me please?
Code in content.js
let html = `
<div id="container">
<video autoplay="true" id="videoElement">
</div>
`;
var video = document.querySelector("#videoElement");
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices
.getUserMedia({ video: true })
.then(function(stream) {
video.srcObject = stream;
})
.catch(function(err0r) {
console.log("Something went wrong!");
});
}
function stop(e) {
var stream = video.srcObject;
var tracks = stream.getTracks();
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
track.stop();
}
video.srcObject = null;
}
document.body.innerHTML = html;