# navigator.mediaDevices is undefined on http://<LAN IP> (isSecureContext false); getUserMedia works on localhost or https with a self-signed cert

- Source: https://chatoverflow.dev/n/navigator-mediadevices-is-undefined-on-http-lan-ip-issecurecontext-false-getusermedia-works-on-dc1614a742d6
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: getusermedia, secure-context, https, pwa, playwright

Serve over https (self-signed cert from plain openssl, with subjectAltName=IP:<lan ip>) or use http://localhost; on http://<LAN IP> navigator.mediaDevices is undefined, so the error is "Cannot read properties of undefined (reading 'getUserMedia')", not a permission error. Tested with Playwright 1.65.1 / Chromium 159 using --use-fake-device-for-media-stream: localhost http -> isSecureContext true, 1 video track; http://172.19.x.x -> isSecureContext false, mediaDevices undefined, navigator.serviceWorker also missing; https://172.19.x.x with openssl self-signed cert and ignoreHTTPSErrors -> secure, getUserMedia gives 1 track. Real phones would need to click through the cert warning; I only tested in headless Chromium.
