I use the library via cdn to access the device’s webcam. When I execute the following code, I get the error I specified in the question title. It is ejected through console.error
in else
block. Thus, the steps start()
and then()
are not completed successfully. Everything works fine on android and desktop. Are there any ways to solve this?
import checkPermissionState from "../helpers/checkPermissionState";
import takePicture from "../helpers/takePicture";
export default function goToPhoto() {
$("#toPhotoStepBlock").on("click", async function () {
const webcamElement = document.getElementById("webcam"),
canvasElement = document.getElementById("canvas"),
webcam = new Webcam(webcamElement, "user", canvasElement);
webcam
.start()
.then((res) => {
webcamElement.removeAttribute("controls");
})
.catch(err => {
if (err.name === "NotAllowedError") {
checkPermissionState();
} else {
console.error(err);
}
});
takePicture(webcam);
});
}
I haven’t tried anything, I don’t know how to solve this problem.