So I've made a WebRTC screen sharing app as a self-hosted alternative to Chrome Remote Desktop and other common remote desktop / game streaming services.
My dilemma isn't navigator.mediaDevices undefinded
. Whenever I launch the app over a file:///
scheme it works perfectly; the same with https://
as mentioned within Mozilla's docs. But the problem is I don't want to host it as it has a few major security issue(s). So how would I host it on 192.168.XXX.XXXX
without it giving the error? (I would like to host it on my local network so I can test it on other mobile devices.)
APIs with functions like getUserMedia
, getDisplayMedia
and enumerateDevices
require a secure context, access to these from http:
origins has been removed in Chrome back in 2019
For development, the easiest solution may be to create a self-signed certificate.
--UPDATE--
For development the easiest solution is to run from localhost, as that's considered secure - see https://blog.mozilla.org/webrtc/camera-microphone-require-https-in-firefox-68/ and https://w3c.github.io/webappsec-secure-contexts/#localhost
Comment from: Vlad Dinulescu