HOW PRIVATE VIDEO CHAT WORKS IN A BROWSER
How Private Video Chat Works in a Browser (Explained Simply)
Have you ever wondered how two phones can see each other on a video call, without WhatsApp, without Zoom, just inside a browser?
I wondered the same thing. So I built it inside my website, Digital City Escape, in the City Cinema & Call Center. And I tested it myself.
Here is the problem. Two phones need to find each other on the internet. Your phone does not know where my phone is. My phone does not know where your phone is. The internet is big. How do they meet?
That is what a room code does. A room code is like a secret meeting place.
When I tested it, I used my phone, an Oppo Reno 7A, and my brother's phone, a Tecno Pop 8. We were in the same room. We both opened my website, went to City Cinema, and typed the same word: HELLO.
HELLO. That was our room code. Nothing special. Just a word we both thought of. And it worked.
When we typed HELLO, both phones went to the same "room" on the internet. Once we were in the same room, they could find each other and start sharing video.
But first, the browser asked us: "Allow camera and microphone?" We had to press Allow. I coded it that way on purpose. No permission, no video. That is for safety.
At first, the video froze. Then it became clear and clear. After that, whatever action I did, my brother saw it truly reflect on his phone without any delay. I waved, he saw me wave. He laughed, I saw him laugh.
That is WebRTC. WebRTC is like a WhatsApp call, but inside the browser. No app to download. The two phones talk directly to each other, like two people talking face to face, not through a middle man.
Tired of reading already, visit the Digital city .
What is STUN? In one sentence.
STUN tells your phone what its real address on the internet is.
Let me explain it simply. When you are at home, you have a house name, but the boda rider needs your real location to find you. Your phone is the same. Inside your house or school WiFi, your phone has a small local address. But the outside world sees a different, bigger address. If my phone does not know your real outside address, it cannot find you.
That is what STUN does. It is like asking someone outside: "Hey, what do you see as my address?"
I used Google's free STUN servers. They are:
`stun:stun.l.google.com:19302`
`stun:stun1.l.google.com:19302`
They are free. My website asks Google: "What is this phone's real address?" Google answers, and then the two phones can find each other. That is all STUN does. One job. It does not carry your video. It just introduces the two phones.
Once they know each other, WebRTC takes over and they talk directly.
Why group calls get slow after 4 people
When it is just me and my brother, it is easy. My phone sends video to one phone. His phone sends video to one phone. One road, two directions.
When you add a third person, it changes. Now my phone must send video to two people, and receive video from two people. When you add a fourth person, my phone must send to three people and receive from three people.
Imagine you are trying to talk to 3 people at the same time, in 3 different rooms, shouting and listening at once. You will get tired. Your phone gets tired too.
That is why I say in my website: "Works best with 2 to 4 people." I tested it. With 3 or 4 people, it became slow, but we would still find it effective because the purpose was not interrupted. We could still see each other, still talk. It was just a bit slower, a bit more frozen sometimes.
If you try 10 people like that, every phone would have to send to 9 people and receive from 9 people. The phone will heat up, the data will finish, and the video will freeze. Big companies solve this by using a big server in the middle. I did not have that. I had direct phone-to-phone. That is why 4 is the sweet spot for my system.
My real test: Airtel, echo, and any word
We tested on both WiFi and Airtel data. Surprisingly, it worked better on Airtel data. On WiFi, sometimes it would delay. On Airtel data, once it connected, it was smoother. I think because our WiFi was shared by many people, but my Airtel data was just for my phone.
And there was a funny moment. Because we were in the same room, testing with two phones close to each other, there was echo. I would speak, my brother's phone would play my voice loudly, then my phone would pick up that same voice again, and it would echo round and round. We laughed so much. We had to move the phones apart or lower the volume. That echo taught me why people use earphones on calls.
The funniest thing was the room code itself. We realised we could put in ANY same word that would come up to our mind, and it worked. HELLO worked. If we typed "MANGO", it would work. If we typed "FOOTBALL", it would work. There was no special password made by the system. We made the password.
That was the moment I understood private video chat. It is not magic. It is just: two phones, one secret word, one STUN to find each other, and then WebRTC to talk directly.
You do not need WhatsApp to video call. You do not need to download an app. You just need a browser, a room code, and permission for your camera.
If I can build that on an Oppo Reno 7A with Acode and free tools, you can build it too. Start with two phones. Type HELLO. Allow the camera. And watch yourself appear on the other phone. That feeling is priceless.
Visit the website now
.jpg)
.jpg)
Comments
Post a Comment