Camera access in chrome extension

I’m trying to get access to webcam through a chrome extension, but to be honest have no clue how it works.

My code works for a simple html file, but when rendering through chrome it doesn’t work. (As in, the “____ wants to use your camera” popup never appears)

Any tips?

Here’s my current working code for html files:

'use strict';

const constraints = {
  video: true,

const video = document.getElementById('video');

  .then((stream) => {
    // video.srcObject = stream;
    vid.src = window.URL.createObjectURL(stream);;
  .catch((err) => {
    console.log(`Rejected ${err}`);