Simple Video Chating with WebRTC

In the Accessing your Webcam in HTML tutorial, we learned about the getUserMedia API and how it allows you to access, among other things, our webcam and display a video stream to our screen. This is kinda cool, but there is a lot more we can do with this API. For example, we can use this API as part of a larger system that allows us to conduct a live video chat:


This is a companion discussion topic for the original entry at http://www.kirupa.com/html5/simple_video_chat_with_webrtc.htm
1 Like

Thanks for your post. All steps’ve been done including Scaledron ID and changing http to https. All is on a server.
But I see only myself in the left video container (see your html), my remote friend see only himself on the same place in the left container. What is wrong?

It seems that scaledrone or java script sees me as a remote user, I think that your example misses an essential part which is how to become a local user, there should be some simple register form, for instance, where I can input my secrete key or some access code. Right? I’m dumb at this, not a programmer at all.

I pinged the author to see if he can chime in on this, for RTC is not my area of familiarity :slight_smile:

Hey Pavel, could you link your site so I could check the JavaScript code. It’s hard to guess what could be wrong otherwise.

Hi sergee, JavaScript code is fine. It is the same as in the post, I’ve only changed Scaledrone channal ID (I registered to Scaledrone), so it works as the example one does only for remote users. You may check the example (see the post), it works the same as my page does. Now I understand that the code doesn’t provide some registration form to accept my ip address, or how it works I don’t know, to set me as a local user. Scaledrone provide a registration solution to a site, but it is all for programmers, my occupation is different, I can only use a ready solution.

You are correct. Scaledrone simply offers a way to connect two hosts and is targeted for developers. If you want an out of the box video solution I highly recommend looking into a ready solution.

Unfortunately I’m not exactly sure what is going wrong. If you still want to use Scaledrone then please upload and share the project with me, otherwise it’s impossible for me to debug it.

Hey Kirupa
Thanks for interesting tutorial and simple solution for a video chat.
I recreated your example and it works when both peers are in the same local network.
However when one is on local wi-fi and seccond is on cellural network the video chat doesn`t start. It is strange because the script detects 2 members and I can send text messages between peers, only the video chat does not fire up.

Any ideas why? Maybe it is some security limitation in browser??

Thanks in advance

Is the video the only thing that isn’t playing via the cellular network? Does the browser developer tools console show any errors? For the cellular test, are you viewing on a mobile device? If so, which device? :phone:

firstly, thank u for this project, this is very good for me… but how can 3 or much person connected for group chat? i can’t this :frowning:

That will require a more elaborate setup on the server. I would look into custom 3rd party streaming services for that level of functionality :grinning:

1 Like

The NAT traversal with STUN doesn’t work. I ran the demo with one computer on WIFI and the other on cellular hotspot and it doesn’t work

1 Like

Hi! I have the same problem. I open the url in two differents devices and in both I see myself as localvideo. I changed the ID, but doesn´t work. I need help, please.

How well would this work on a security camera controlled using a Raspberry Pi? The application uses the Nodejs webserver running express framework to handle pan, tilt and zoom. Do you think it will work ? Thanks, your code has been the best documented I have found

i also have the same problem i only see the local video. when we connect the same network its working fine but when we connect different devices with different network it only shows the local video please anyone give me the solution for this

thanks in advance…!

Is there any way to get more that two people in a call using this same method?
current site at: https://gameplexcorp.weebly.com/meetup-room.html#testroom

This method is incompatible with the safari browser if that is what you are trying to use.

Hello,
I have two different webcams, how do I add the button / task that I can switch between?
Also, can the participant switch between my cameras?

“For example, if the participant wants to see my detail camera, he / she can select it over the system, if he / she wants a general view, he / she should choose my other camera.”

Thanks in advance

Are both webcams connected to the same machine?

Hello
Yes