I am currently trying to use the WebRTC api and have everything working locally.
When I deploy to surge.sh
I lose access to the navigator.mediaDevices
object. How can I resolve this?
The following line of code is where I am having trouble with.
const stream = await navigator.mediaDevices.getDisplayMedia({video: {mediaSource: 'screen'}});
I receive the following error message:
TypeError: Cannot read property 'getDisplayMedia' of undefined
You need https.
navigator.mediaDevices
is only available in SecureContext now in Chrome 74, Firefox 68, and in the spec, which means the object will be missing in insecure contexts (http).