We want to capture users screen,desktop application, browser’s tabs using getUserMedia API. where it first ask user to give permission and then share stream.
But it mentioned that we can only call this API from secure origin (https or localhost).
We already have website (hosted on https and as local product you can host on http as well) and hosted web extension (for firefox)
our flow is like this -
user login to our web page, where It will send message to content script to capture media
content script will send message to extension’s background
then extension should have to use getUserMedia API to launch permission popup and start capturing media stream
but when we execute this API in background then it not launching permission poup.
Please suggest any possible solution for this and If it is not support then let us know what experience we can use here.
I think the getUserMedia call needs to happen in the content script, and not the background script. The background script is global to the entire browser, so it wouldn’t know which tab to run this for.
I tried following api in content script -
navigator.mediaDevices.getUserMedia(constraints)
but it throws error -
chrome-extension://glhknecmiannbjlkopjnacjmphbpnbkm/ContentScript/CustomisedWorkItemMessaging.js:54 [Deprecation] getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
Uncaught (in promise) DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).