Development discussions around Shopify APIs
Hello,
I am developing a Shopify app that requires webcam access. I tried using a React package for the purpose, but the viewfinder never seems to appear. As an alternative, I also attempted to add a video tag to the webapp and set its source like so:
let myRef = React.createRef()
useEffect(() => {
var video = myRef.current
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video: true })
.then(function (stream) {
video.srcObject = stream;
})
.catch(function (err) {
console.log(err);
});
}
});
Unfortunately, it looks like my access to the DOM was completed blocked, as the catch block keeps getting triggered with an error of that nature.
Would anyone be able to guide me in the right direction? I believe it should be possible, because Shopify has a barcode scanner component that must access the device's camera...
Thanks,
Phil
User | RANK |
---|---|
11 | |
6 | |
5 | |
5 | |
5 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022