1

I want to access the webcam to use it in my chrome extension. I'm getting this error DOMException: Permission denied when the popup is opened, I have the needed code to query the webcam in my popup.js file. How I can use webcam in my chrome extension and fix this error?

I've looked at the documentation to try understanding if there is any permission to add into the manifest file but I didn't find any info about. Can someone help me?

in my poupu.js I have this code

navigator.getUserMedia({ video: true, audio: false }, (stream) => {
 this.$refs.video.srcObject = stream
}, (err) => {
 console.log(err)
})

NB: I'm using vue to manage the front-end stuff of the extension

fed3vt
  • 279
  • 1
  • 4
  • 16
  • It's a bug in Chrome, probably. I think you'll have to ask for the permission in a normal tab. You can have a dedicated html page in your extension for this purpose and open it in a tab, or you can add an iframe inside the current web page that points to that html file (exposed via [web_accessible_resources](https://developer.chrome.com/extensions/manifest/web_accessible_resources)). – wOxxOm Sep 17 '20 at 11:22
  • so to fix this I need to create a new tab instead of using the popup?At the moment I have a new popup window opened when the user click the extension icon, I need to change it to a new tab right? – fed3vt Sep 17 '20 at 11:35
  • That's exactly what I wrote, isn't it? The reason is that the popup is a separate window, it's not a part of the tab so Chrome can't ask the permission. – wOxxOm Sep 17 '20 at 11:42
  • ok, thank you for the help. I hope this bug will be fixed soon. – fed3vt Sep 17 '20 at 11:56
  • Does this answer your question? [How to use webrtc insde google chrome extension?](https://stackoverflow.com/questions/29177097/how-to-use-webrtc-insde-google-chrome-extension) – O. Jones Sep 17 '20 at 13:56

0 Answers0