philnash / twilio-video-react-hooks

A video chat application built with Twilio Video and React Hooks
MIT License
110 stars 61 forks source link

Uncaught (in promise) Error: getUserMedia is not supported #37

Closed anagharm closed 4 years ago

anagharm commented 4 years ago

Hi Philnash,

I have separated the token generation (node API) and video call (React). When I am running the code on local it is working fine. It is also working fine when I am accessing node API from server and React from local. But it fails as soon as both the React and Node code is on server. It is giving me following error in console:

getusermedia.js:21 Uncaught (in promise) Error: getUserMedia is not supported at Object.e.exports [as getUserMedia] (getusermedia.js:21) at Object.e.exports [as createLocalTracks] (createlocaltracks.js:124) at Q (connect.js:772) at cancelableroompromise.js:20 at cancelablepromise.js:51 at new Promise () at new e (cancelablepromise.js:50) at e.exports (cancelableroompromise.js:18) at Object.e.exports [as connect] (connect.js:274) at Room.js:25

Please help me. Its urgent as tomorrow is last day.

Thanks in advance...

philnash commented 4 years ago

On the server you don't have access to a user's camera and microphone, as you do through the browser. That's why you are getting an error that says Error: getUserMedia is not supported. getUserMedia is the browser API that gets access to the user's camera and microphone.

What were you expecting to do in the server side React portion here? Are you working with a framework that lets you run React on the client and the server and does it have the ability to only run blocks of code on the client?

anagharm commented 4 years ago

ok. Will check and update you

anagharm commented 4 years ago

I am using same code which you have given. I dont know react so not able to get what you are saying. Can you give any other hint

philnash commented 4 years ago

Yes, but you said you are running the react code on the server. How/why are you doing that?

anagharm commented 4 years ago

Actually My team is working on it. I have very little knowledge of react. I am basically working on API side. Also I handle the server side. I can understand only the flow, but not the flow.

philnash commented 4 years ago

Ok, can you get someone who is working on it to comment?

anagharm commented 4 years ago

I have asked my team member. He will be available in an hour so

philnash commented 4 years ago

@anagharm Did you find someone to share what they are doing?

anagharm commented 4 years ago

Sorry @philnash For delay in the replay. My issue got resolved when I have redirected to the url which is having SSL certificate.

In short both API (Node JS code and ReactJS code) must have SSL certificate.

Thank you for the support.

philnash commented 4 years ago

Ah, ok, you were running the client side without SSL and that's why getUserMedia wasn't working. I'd read MDN on the privacy and security behind getUserMedia to understand more.

Glad you got things sorted. I'll close this now. Thanks!