WebRTC in a Nutshell (Ep-I)
Introduction to WebRTC
If you ever wonder about the term WebRTC and Google it, you most probably encountered a sentence similar to;
WebRTC is an open-source project that allows you to add peer-to-peer real-time communication capabilities to your applications.
First, this is a strong sentence and I would like to break it into pieces.
1. Open Source Project
As the name implies, it is an open-source project. It is free to use.
2. Peer to Peer
You don’t need an expensive media server for WebRTC. When I say expensive, believe me, it is expensive to use a media server. A video call can need 1 Mbit/s bandwidth. If you have a platform with 1000 active users, you will need 1Gbit/s bandwidth. What if you have 1 million users?
3. Real-time Communication
Most of us think Audio-Video calls when we hear the real-time communication concept. It is not wrong but real-time communication is a wider concept.
You can transmit real-time data using WebRTC.
The popular online game Haxball uses WebRTC for us to have fun.
ShareDrop is a website that allows you to send files peer to peer. You can send files to your local network and even different networks peer to peer.
When WebRTC was first released, it was aimed at Web applications running on Chrome. But today you can develop WebRTC applications on almost all popular browsers, Android, iOS, and desktop platforms.
You can develop a real-time communication app that can work on any platform you like!
Popular browsers like Chrome, Firefox, Safari, Edge, and Opera support WebRTC on both desktop and mobile browsers. WebRTC also allows app developers to use native frameworks for iOS and Android native development.
Which products use WebRTC?
WebRTC became a telecommunication standard for video & audio calls. Most of the popular video call applications already using it. Like;
- Microsoft Teams
- Google Meet & Google Duo
- Facebook Messenger
So, the answer to the question “Who uses WebRTC?” is all of us.
According to Kranky Geek event in 2017, Google shared in their session this statistic:
Keep in mind that this statistic is 4 years old and before the pandemic period, which skyrocketed the usage of video & audio calls. It is not crazy to assume that current WebRTC usage in one day is more than billions of minutes.
What are the advantages of WebRTC?
You may ask, “Why does this popular telecommunication application use WebRTC? What are the advantages?”.
If you try to create an application or platform for real-time communication, you need to consider a lot of parameters, like;
- Communication quality (Latency, media quality, stability, etc.)
- Accessing device hardware (Camera, Microphone, etc.)
- Network Usage (Bandwidth usage, network restrictions, etc.)
- Video & Audio encoding/decoding
- UX improving capabilities (noise reduction, echo cancellation, etc.)
- Supporting multiple platforms (Windows, Mac, Linux, Android, iOS, etc.)
Those are the bullets that I can just think about now. Those bullets might be easy to write but believe me, each of them can be lecture topics at college for semesters or even years.
Using WebRTC you don’t need to consider the items above!
WebRTC gives application developers to initiate real-time communication ability using simple APIs.
This API’s as simple as
getUserMedia(). As you can guess, the app can access the device’s camera and microphone using this API. We will discuss other important APIs and get into details in the upcoming articles.
What is the responsibility of Applications?
You may think about that “If WebRTC is so capable what should I do as an app developer?”.
Signaling Channel and Media Channel are two different concepts in telecommunication. When you call your friend, first your phone sends a call request to your friend’s phone. Then, if your friend accepts the call, it will send your phone an accept call response. This process happens on the Signaling Channel. After your device receives accepts the response, you can hear your friend and this happens on the Media Channel. WebRTC follows the same approach as other telecommunication technologies.
WebRTC takes care of the media transportation in media channels, but it expects applications to handle signaling.
We will get into details in the upcoming articles, but the short story is applications should transmit call signaling to each other. As the diagram below demonstrates, your application on Device-1 should interact with WebRTC to reach required APIs and sends requests to Device-2. Then Device-2 should do the same as well and that’s it! WebRTC will take care of media transmission.
Even with this simplicity, the application does have a lot of responsibility because of signaling. In this WebRTC in a Nutshell Series, we will look into them one by one in each episode.
Until we meet again, take good care of yourself!
If you prefer to read the second article here is the link;