Why webrtc
Agora 2021-06-04 10:58:31


In recent years, the application of real-time audio and video communication has shown a trend of explosion . Behind these real-time communication technologies , There is a technology that has to be mentioned ——WebRTC.


This year, 1 month ,WebRTC By W3C and IETF Issued as a formal standard . According to the Research Institute GrandViewReseach Report display for , expect 2025 In the world WebRTC Market size will reach 210.23 Billion dollars , Comparison 2019 year 23 Billion dollar market size ,5 The compound annual growth rate in is 43.6%.


This series will discuss with you , Why? WebRTC Favored by developers and enterprises ? future WebRTC And how to develop ? And the sound network Agora How is it based on WebRTC Secondary development , And how to support WebRTC NV Version of ?

Online meetings 、 Online education 、 Online interview 、 Online social networking 、 Online medicine 、 Financial securities online account opening 、 Smart home has become a very familiar part of modern people's life , Turn common offline scenes to online , People can experience the above scenes without leaving home . These real-time interactive scenes have largely changed our original way of life .


If we go back to 10 Years ago , That is to say 4G When it comes to commercial use , Almost all media and technology are emphasizing 4G You can watch HD video , But most of them focus on how convenient it is to watch videos on mobile phones , No one predicted a complete burst of short video ; Most people know 4G The upload speed can be live video , But the idea at that time was more applied to professional journalism , I didn't expect the coming of the era when all people can live ; The idea of video conference is mostly based on the demand of transnational office , But I didn't expect that last year , Online office has become almost every office worker's daily life .


During this decade , How is the daily use of real-time interactive scenes realized step by step ?


from 2010 About years ago , Real time communication can only use proprietary software 、 Plug-in or Adobe Flash Real time communication ;2013 year ,Chrome and Firefox The first cross browser video call between ;2014 year , The first cross browser data transfer was realized , Real time communication through the client opens up an emerging trend ...... Today, , It is called WebRTC, We are in every day Chrome,Mozilla Firefox,Opera,Safari,Edge,iOS and Android Use it in real-time interactive scenarios .

WebRTC It's a by Google、Mozilla、Opera And so on , The name comes from web instant messaging (Web Real-Time Communication) Abbreviation . therefore , It is not difficult to see that the initial goal of this technology is to prepare for the realization of real-time audio and video transmission freely on the browser .

“ Actually WebRTC It has different meanings in different scenarios , It can represent Google Open source WebRTC project , Can also represent W3C(World Wide Web Consortium- World wide web consortium )  The working group developed WebRTC standard , It can also represent WebRTC Interface , We call them WebRTC technology .”【1】 Most of the time , For developers WebRTC Is a set of support web browser for real-time audio and video dialogue W3C Javascript API, It includes audio and video capture 、 codec 、 Network transmission 、 Display and other functions .

Because almost all mainstream browsers support WebRTC standard API , So it also makes it possible for browsers to communicate audio and video without plug-in , Greatly reduced the threshold of audio and video development , Developers just need to call WebRTC API You can quickly build audio and video applications .

“WebRTC Our mission is to enrich 、 High quality RTC The application can provide the browser with 、 Mobile platforms and IoT Equipment development , And allow everyone to communicate over a common set of protocols .”

WebRTC What problems have been solved ?

In the absence of WebRTC front , For developers RTC The difficulty of communication mainly comes from the complexity of the Internet 、 Delay sensitive 、 The fluency and clarity of real-time audio and video are low, and the operation cost is high . But these problems are WebRTC After the emergence, they have been better solved :

1、 The Internet is complex

Different NAT、 Firewall to media P2P It's a big challenge to set up . and WebRTC The emergence of browser provides end-to-end direct communication , Make it easy for developers to make this connection . meanwhile ,WebRTC There are P2P Open source project for drilling holes libjingle , Support STUN,TURN Such agreement .

2、 Delay sensitive

Early RTC In technology ,TCP(Transmission Control Protocol- Transmission control protocol ) Due to the defects of its own mechanism , Only use UDP transmission , But this requires developers to solve the problem of retransmission 、 Disorder and so on . and WebRTC It provides NACK,FEC technology , No longer need to route through the server , Reduces latency and bandwidth consumption . Direct communication can improve the speed of data transmission and file sharing .

3、 Fluency

The Internet is unstable , Especially some small operators , In the peak period of traffic usage, it is often unable to guarantee enough bandwidth . We need an adaptive algorithm to deal with network congestion 、 Smooth transmission and so on .WebRTC Provided in TCC + SVC + PACER + JitterBuffer Technical support .

4、 Clear voice

Due to the complexity of terminal equipment and environment , There will be noise 、 The interference of echo , Now WebRTC Provides 3A Algorithm + NetEQ, So that the real-time environment of sound processing and interactive experience has been greatly improved .

For developers or businesses , Use WebRTC All you need to do is download compatible WebRTC And use , No additional software is needed 、 With the participation of plug-ins or continuous servers, audio and video applications can be easily embedded into any website , And pass Internet Connect , Greatly save the development time and cost .

At present, mainstream browsers such as Microsoft Edge、Google Chrome、Mozilla Firefox、Safari、Safari、Opera、Vivaldi And so on WebRTC.

Use WebRTC Is it safe? ?

WebRTC As an open source technology , Can be in any Web It's free on the browser , And not limited by plug-ins . that , Someone might ask , Use WebRTC Is it safe? ? Use WebRTC Will there be malicious access to my user data or private network ?

Don't worry , On the safety side ,WebRTC We also did the optimization design : all WebRTC Media data must be encrypted .

because WebRTC It's not a plug-in , There's no need to install other plug-ins , So all applications can run in the sandbox of the browser , There's no need to create additional processes . That's why , WebRTC It effectively prevents malicious software from entering the user's system . In any real-time communication application , The process of data transmission may increase the security risk , So encryption is WebRTC The mandatory function of , And enforce... On all media data .【2】

WebRTC Using two standardized encryption protocols :

Datagram transport layer security (DTLS)

  • Standardized protocols built into browsers . It's based on the transport layer protocol (TLP) Data stream encryption for ;

  • because DTLS Using the user data protocol (UDP), So the semantics of transmission are preserved ;

  • It's the secure socket layer (SSL) An extension of , whatever SSL Protocols can be used to protect WebRTC data , This allows end-to-end encryption .

Secure real time transport protocol (SRTP)

  • For media stream encryption ;

  • It's a real-time transport protocol (RTP) An extension of , The protocol has no built-in security mechanism ;

  • Real time transport protocol (RTP) Provide encryption 、 Integrity assurance and message authentication .

(* but SRTP The protocol also has some disadvantages , For example, although it is RTP Packets provide encryption , But the header is not encrypted .)


In our daily use of the Internet to download applications 、 Movies or email messages / In the process of documentation , In fact, there may be a risk of malicious invasion . however ,WebRTC The technology has passed the above standards , can To effectively protect the transmission of sensitive data , Provide guarantee for secure real-time communication environment .

WebRTC It's a far-reaching effort of the Internet industry in real-time communication , It greatly reduces the threshold for developers to realize real-time audio and video communication function . Then I have a good idea , You can use it directly WebRTC For development and commercial use ?( Rub hands ...) unfortunately , The answer is No .

because WebRTC Our transmission is based on the public Internet , The public Internet is not designed for real-time communication , So in the network protocol 、 Cross regional bandwidth 、 Cross operator 、 User equipment 、 Network architecture 、 Document support and other aspects will be helpful to WebRTC There are constraints in the development of , This will lead to real-time audio and video transmission quality can not be effectively guaranteed .

* About WebRTC Please refer to :WebRTC Current situation, advantages and disadvantages , Audio and video communication must see the open source project

therefore , It can be said that if WebRTC If you bring it directly to business , It's almost impossible , Now the common solution is self research , According to their own business scenarios for secondary customization development , Or more simply, using a third party SDK.(Agora WebSDK Is based on WebRTC Packaged API aggregate , Extremely simple , More developer friendly , Can complete a simple... In ten lines demo And online . Click on 【 Read the original 】 Details available .)

About WebRTC How to develop secondary customization and WebRTC Best practice content of , We'll share with you later in this series .

Coming soon ~ 

Reference material :

【1】 Mao Yujie . 2018. Attacking WebRTC: Why do we need it ?-InfoQ. [online] Infoq.cn. Available at: <https://www.infoq.cn/article/why-do-we-need-webrtc> [Accessed 28 April 2021].

【2】Grandviewresearch.com. 2021. Web Real-Time Communication Market Report, 2020-2027. [online] Available at: <https://www.grandviewresearch.com/industry-analysis/web-real-time-communication-market> [Accessed 18 May 2021].

Please bring the original link to reprint ,thank
Similar articles