# Simple Video Chating with WebRTC

**URL:** https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297
**Category:** programming
**Created:** [October 11, 2017, 6:36pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297 "2017-10-11T18:36:46Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [October 11, 2017, 6:36pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/1 "2017-10-11T18:36:46Z")

</div>

In the [Accessing your Webcam in HTML](https://www.kirupa.com/html5/accessing_your_webcam_in_html5.htm) 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](http://www.kirupa.com/html5/simple_video_chat_with_webrtc.htm)

---

<div class="post-metadata">

### Author: ![Pavel\_Afonin](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pavel_afonin/32/8979_2.png) [@Pavel\_Afonin](https://forum.kirupa.com/u/Pavel_Afonin)
#### Post date: [February 12, 2018, 12:12am UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/2 "2018-02-12T00:12:36Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Pavel\_Afonin](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pavel_afonin/32/8979_2.png) [@Pavel\_Afonin](https://forum.kirupa.com/u/Pavel_Afonin)
#### Post date: [February 12, 2018, 4:15pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/3 "2018-02-12T16:15:56Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [February 13, 2018, 12:00am UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/4 "2018-02-13T00:00:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sergee](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sergee/32/8986_2.png) [@sergee](https://forum.kirupa.com/u/sergee)
#### Post date: [February 13, 2018, 7:28am UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/5 "2018-02-13T07:28:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Pavel\_Afonin](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pavel_afonin/32/8979_2.png) [@Pavel\_Afonin](https://forum.kirupa.com/u/Pavel_Afonin)
#### Post date: [February 13, 2018, 1:37pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/6 "2018-02-13T13:37:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sergee](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sergee/32/8986_2.png) [@sergee](https://forum.kirupa.com/u/sergee)
#### Post date: [February 13, 2018, 4:47pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/7 "2018-02-13T16:47:10Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Maciej\_Wojnicki](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/maciej_wojnicki/32/10921_2.png) [@Maciej\_Wojnicki](https://forum.kirupa.com/u/Maciej_Wojnicki)
#### Post date: [January 17, 2020, 11:26am UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/8 "2020-01-17T11:26:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [January 17, 2020, 7:37pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/9 "2020-01-17T19:37:03Z")

</div>

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? ☎

---

<div class="post-metadata">

### Author: ![Engin\_Varol\_Demirel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/engin_varol_demirel/32/11605_2.png) [@Engin\_Varol\_Demirel](https://forum.kirupa.com/u/Engin_Varol_Demirel)
#### Post date: [May 1, 2020, 2:05pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/10 "2020-05-01T14:05:34Z")

</div>

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 ☹

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [May 2, 2020, 11:54pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/11 "2020-05-02T23:54:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Misha\_Glushakov](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/misha_glushakov/32/11641_2.png) [@Misha\_Glushakov](https://forum.kirupa.com/u/Misha_Glushakov)
#### Post date: [May 5, 2020, 8:21pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/12 "2020-05-05T20:21:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Carla\_Paz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/carla_paz/32/11643_2.png) [@Carla\_Paz](https://forum.kirupa.com/u/Carla_Paz)
#### Post date: [May 6, 2020, 4:46pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/13 "2020-05-06T16:46:09Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![hahobson](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@hahobson](https://forum.kirupa.com/u/hahobson)
#### Post date: [May 18, 2020, 1:02pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/15 "2020-05-18T13:02:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jeeva\_mugunthan](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jeeva_mugunthan/32/12583_2.png) [@jeeva\_mugunthan](https://forum.kirupa.com/u/jeeva_mugunthan)
#### Post date: [October 5, 2020, 1:14pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/16 "2020-10-05T13:14:11Z")

</div>

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…!

---

<div class="post-metadata">

### Author: ![TJP\_Gaming\_126](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tjp_gaming_126/32/12891_2.png) [@TJP\_Gaming\_126](https://forum.kirupa.com/u/TJP_Gaming_126)
#### Post date: [November 17, 2020, 8:42pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/17 "2020-11-17T20:42:17Z")

</div>

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](https://gameplexcorp.weebly.com/meetup-room.html#testroom)

---

<div class="post-metadata">

### Author: ![TJP\_Gaming\_126](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tjp_gaming_126/32/12891_2.png) [@TJP\_Gaming\_126](https://forum.kirupa.com/u/TJP_Gaming_126)
#### Post date: [November 18, 2020, 2:04pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/18 "2020-11-18T14:04:00Z")

</div>

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

---

<div class="post-metadata">

### Author: ![artdzy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/artdzy/32/13837_2.png) [@artdzy](https://forum.kirupa.com/u/artdzy)
#### Post date: [March 11, 2021, 12:45pm UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/19 "2021-03-11T12:45:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [March 12, 2021, 4:14am UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/20 "2021-03-12T04:14:43Z")

</div>

Are both webcams connected to the same machine?

---

<div class="post-metadata">

### Author: ![artdzy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/artdzy/32/13837_2.png) [@artdzy](https://forum.kirupa.com/u/artdzy)
#### Post date: [March 12, 2021, 4:28am UTC](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297/22 "2021-03-12T04:28:44Z")

</div>

Hello  
Yes

[Next page](https://forum.kirupa.com/t/simple-video-chating-with-webrtc/637297.md?page=2)
