Skip to content Skip to sidebar Skip to footer

How To Stream Webcam Into Mobile Browser By Using Reactjs?

I have created a simple react app that streams the webcam video stream on the browser. Here's the link to the github project : Basic WebCam Streamer The code is pretty simple and

Solution 1:

I have solved this issue. 1. Open package.json and paste this inside scripts:

"start": "set HTTPS=true&&react-scripts start"

This should serve the app over https 2. If this gives you this error:

React app error: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS

Open

node_modules/react-dev-utils/webpackHotDevClient.js

And paste this code inside the definition of the connection:

protocol: window.location.protocol === 'https:' ? 'wss' : 'ws',

This is apparently a bug in react-sripts that hasn't been solved yet. If https protocol is being used we should use WebSockets over SSL/TLS (WSS) protocol instead of WebSockets (WS). You can learn more about it here:

NOTE: This will not stream your pc webcam into your phone but rather the phone's camera.

Post a Comment for "How To Stream Webcam Into Mobile Browser By Using Reactjs?"