Basics of WebRTC (Web Real-Time Communication) (video/audio calling)

TARANG SHARMATARANG SHARMA
3 min read

Table of contents

I will have 3 major blogs over WebRTC architecture (1->basics , 2-> intermediate , 3->advance) , As we progress through these blogs, the level of detail and complexity will gradually increase..

Later you will also have details blogs over mediasoup and its architecture ( sorry I am going to fast , lets ignore that , and move forward with basics of video calling , so that you can create your own video calling application !!) .

In this blog post, I'll guide you through the fundamentals of video calling and then explore more advanced topics. If you're aiming to create a video or audio calling application, WebRTC is an excellent choice, especially for peer-to-peer (P2P) connections .

P2P stands for peer-to-peer, and P2P video calling is a type of video conversation that connects participants directly to each other without a central server.

. It offers the fastest data transfer, which is crucial for a seamless user experience.

WebRTC (Web Real-Time Communication) is an open-source technology.

  • Video conferencing: Users can see and talk to each other in real-time.

  • Audio calls: Users can make voice calls directly through their web browsers.

  • Screen sharing: Users can share their screens with others.

  • File sharing: Users can send files to each other.

Benefits of WebRTC

  • Real-time communication: Enables instant audio and video calls.

  • Peer-to-peer connections: Reduces latency and improves performance.

  • No plugins required: Works directly in web browsers.

  • Cross-platform compatibility: Works on various devices and operating systems.

  • Open source: The technology is freely available for developers to use.

Let's dive into the fascinating world of WebRTC architecture. (Things will get interesting from now!! yay!!)

Finding connection candidates

Steps in webrtc connection for video calling :

1. Signaling:

  • Negotiation: The peers exchange information about their capabilities, such as supported codecs, resolutions, and network conditions.

  • Offer and Answer: One peer (initiator) sends an offer, and the other peer (responder) sends an answer, confirming their agreement on the communication parameters.

  • Ice Candidate Exchange: Both peers exchange ICE candidates, which are network addresses and ports that can be used for direct communication.

2. ICE (Interactive Connectivity Establishment):

  • Connectivity Checks: ICE tries to establish a direct connection between the peers using the exchanged ICE candidates.

  • NAT Traversal: If a direct connection is blocked by firewalls or NAT (Network Address Translation), ICE uses techniques like STUN (Simple Traversal of UDP through NAT) and TURN (Traversal Using Relays via NAT) to relay the media streams.

3. Media Exchange:

  • Data Channels: If necessary, data channels can be established for non-media data (e.g., signaling, chat messages).

  • Media Streams: Once a successful connection is established, the peers exchange media streams (audio, video, or both) , it is done using RTP.

4. Session Maintenance:

  • Connectivity Checks: The peers continuously monitor the connection quality and re-negotiate parameters if necessary.

  • Error Handling: If errors occur (e.g., network issues, device failures), the peers handle them gracefully and attempt to re-establish the connection.

In the next blog we will see what happens at every step and why these steps are necessary .

Please follow , Like ,and share the blog !!.

Thank you ,take care!!.

0
Subscribe to my newsletter

Read articles from TARANG SHARMA directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

TARANG SHARMA
TARANG SHARMA