1

I want to put video tag on the dropdown menu of Chrome extension. In my dropdown.html of the extension I'm creating, I put the video tag and script tag.

    <video autoplay="true" id="cameraLive"></video>
    <script type="text/javascript">
        var video = document.querySelector("#cameraLive");

        if (navigator.mediaDevices.getUserMedia) {
            navigator.mediaDevices.getUserMedia({ video: true })
                .then(function (stream) {
                    video.srcObject = stream;
                })
                .catch(function (err0r) {
                    console.log("Something went wrong!");
                });
        }
    </script>

When I open dropdown.html in browser, it works fine. But on extension, it does not work. The error says:

Refused to execute inline script because it violates
the following Content Security Policy directive:
"script-src 'self' blob: filesystem:".
Either the 'unsafe-inline' keyword, a hash ('sha256-H1sZS7OyOYQVjQrWlBxGG3pZLyVentv7JICMQKRUwf8='),
or a nonce ('nonce-...') is required to enable
inline execution.

How to solve this?

Hotte Shen
  • 615
  • 4
  • 19

0 Answers0