Build a real-time audio and video platform based on WebRTC zero foundation

introduction

In recent years, multi-person video interaction models such as online education, werewolf killing, online doll catching, and online KTV have continued to emerge. Real-time audio and video communication is gaining momentum, and the real-time audio and video technology WebRTC has also received widespread attention. Relevant data shows that during 2017-2021, the global WebRTC market will grow at an average annual compound growth rate of 34.37%. (Data source: Technavio "Global Network Real-time Communications (WebRTC) Market, 2017-2021" report)

A new era of real-time interaction: Attacking WebRTC

After the WebRTC 1.0 standard draft was released in November 2017, more and more manufacturers began to broadly support it. WebRTC official data shows that WebRTC has been used by more than 1,300 companies and projects, and is supported by more than 80% of browsers. WebRTC is used in various well-known applications: WhatsApp, Facebook Manager, http://appear.in and TokBox, etc.

WebRTC, whose full name is Web Real Time Communication, is an open source project promoted by Google. Its initial goal is to implement plug-in-free real-time audio and video calls for browsers. Building a platform based on WebRTC to realize Lianmai interaction can greatly reduce the access threshold and development cost of audio and video communication:

1

80% of browsers support WebRTC

Before Google made WebRTC open source, achieving real-time communication between browsers was a difficult task. Now, developers do not need to pay attention to the audio and video engine implementation details, and can implement audio and video communication functions on the Web using simple HTML tags and JavaScript APIs. Currently, mainstream browsers such as Chrome, Safari, Firefox, and Opera all support WebRTC. As one of the H5 standards, more browsers will support it in the future.

2

Enables full-platform interconnection and interoperability

Imagine this scenario: when you share a web link with a friend on your mobile phone, you must expect the other party to open a browser and have a real-time conversation with you. Therefore, achieving cross-platform interconnection is a very important experience. Google has opened up the underlying C++ interface. Based on this interface, developers can develop applications for iOS, Android, Mac, Windows and other platforms to achieve interconnection and interoperability of applications on all platforms.

3

WebRTC has powerful hole-digging capabilities

WebRTC technology includes key NAT and firewall penetration technologies using STUN, ICE, TURN, RTP-over-TCP, and supports proxies to ensure that P2P clients can realize file information, processor computing power, storage space and other resources through direct communication of sharing.

4

Safe and reliable, stable quality

WebRTC provides reliable video and audio data encryption functions to ensure the security of audio and video data transmission on the public network without worrying about information theft. For enterprises with sensitive data, secure transmission and storage of data can be achieved as long as they cooperate with private storage. At the same time, Google's strong technical endorsement and support can ensure rapid updates and iterations of technology, such as sound noise reduction, volume gain, and echo cancellation, which can greatly optimize the user experience and ensure stable quality.

The distance between WebRTC and industrial applications

From this point of view, it seems that it is not difficult to implement real-time audio and video calls based on WebRTC. However, in fact, there is still a long way to go from WebRTC to an industrial-level application:

1. The entire platform supports a large amount of development: WebRTC only provides access capabilities to the Web, and does not provide easy-to-use SDKs for Android, iOS, Windows and other clients. . It poses a great challenge to the developer's ability and experience, and for companies that lack audio and video technology accumulation, this will undoubtedly increase development costs and prolong launch time.

2. Natural disadvantages of P2P connection method: The biggest problem of P2P connection method is that the connection success rate is not high. The foreign official data given by Google is 86%. In the scenario of multi-person interaction, the P2P model is even more powerless. When multiple people interact, they need to publish their own streams to multiple people at the same time, which requires high uplink bandwidth. The current network environment is difficult to support multi-person conversation scenarios.

3. Single scenario support: P2P uses end-to-end direct connection and does not have a server. Therefore, the supported scenarios are limited to 1-to-1 simple communication, no The method is to provide processing services for audio and video streams on the server side, such as: confluence, bypass live broadcast, watermarking, transcoding, etc.

Therefore, for companies with less audio and video technology capabilities, choosing a reliable one-stop solution provider can greatly reduce development costs and shorten product launch time.

Qiniu Real-time Audio and Video Cloud is a real-time audio and video solution based on standard WebRTC, and also optimizes the above problems of WebRTC. Qiniu Real-time Audio and Video CloudProvides a full-platform real-time audio and video SDK, and provides customers with self-developed RTC acceleration network and powerful cloud capability support >Provide cross-platform, high-quality, customizable one-stop solutions.

Qiniu provides industrial-level solutions based on WebRTC

1

P2S connection model to achieve 1-to-many interaction

The connection model of Qiniu RTN is called P2S (Peer to Sever) and adopts the SFU topology solution, that is, the forwarding model solution. We added a server between Client A and Client B. Signal Sever does end-to-end signaling transmission. Media Sever is responsible for establishing the data channel. Based on Media Sever, we can complete the forwarding volume. Compared with WebRTC's P2P model, P2S can not only avoid the problem of small uplink bandwidth, but also achieve real-time audio and video interaction between multiple people.

P2P model P2S model

2

RTC accelerated network, high reliability and low latency

Qiniu RTC's self-developed acceleration network is a real-time transmission network. Compared with general acceleration networks, it has global node and multi-type supplier line support. It adopts a fully self-developed edge acceleration solution and fully supports the acceleration of signaling and data transmission. , intelligently allocate streaming media servers and acceleration lines, thereby ensuring high connectivity and low latency across the entire network.

RTC acceleration network

3

Bypass live broadcast cloud storage, support on-demand playback

"Bypass live broadcast" and "on-demand playback" are common derivative scenarios of real-time interaction. For example, if several people have a real-time meeting online, and thousands of people also want to watch the meeting live, this requires the server to forward the stream to the live broadcast, which is called "bypass live broadcast". Bypass live broadcast can be achieved at a lower cost. Maximize dissemination of interactive information:

For example, in application scenarios such as finance, government affairs, customer service, etc., interactive content needs to be stored for record keeping. It can be sliced ​​and stored in Qiniu Cloud in real time; for education, show interaction and other scenarios, the stored audio and video can be stored later. The content is then redistributed through CDN.

4

Support server convergence to cope with various terminal models

From the perspective of distribution cost and storage cost, before performing bypass live broadcast and cloud storage, it is usually necessary to merge multiple interactive screens into one screen. This process is called "merging". Merging can be completed on the client or server. Although client merging is a relatively simple merging method, it has problems such as hot mobile phones and unstable merging. Compared with client merging, server merging has lower requirements on terminals. , the merged picture is smoother and the picture quality is clearer, which greatly reduces the heating and lag of the mobile phone. Qiniu adopts a GPU converging solution on the server side, which can greatly improve the efficiency, stability and picture quality of converging.

Qiniu RTN officially launched

Support seamless access in various scenarios

Qiniu Cloud Real-time Audio and Video Cloud (RTN) has been officially launched. It has shown strong usability in social networking, education, medical care, finance, conferences, government affairs and people's livelihood, and can meet the needs of various scenarios.

· Social field: Supports anchors to connect with each other or hosts and viewers to connect with each other, and provides functions such as beauty, filters, eye enlargement, face slimming, etc. to meet interesting interactions.

· Education field: Flexibly supports one-to-one education, interactive small classes, and large classes with 10,000 people. The entire platform is interoperable and supports screen sharing to meet educational needs in multiple scenarios.

·Interactive meeting: Supports small team online communication and large-scale online meetings, and can easily create an application similar to WebEx.

· Medical field: Support remote multi-party video consultation, break through the geographical restrictions of medical resources and system platform restrictions, improve the geographical flexibility of doctor-patient time, and reduce diagnostic costs.

·Financial field: Support video call requests to technical support personnel. Technical support personnel will guide users through video operations, quickly locate and solve problems, and improve service quality and product reputation. .

·Government Affairs and People's Livelihood: Supports government audio and video call needs such as online court hearings, remote alarms, and remote emergency command, making it convenient for municipal staff to make two-way audio and video calls with citizens through multi-terminal browsers .

In the above scenarios, the one-stop solution provided by Qiniu RTN can save videos and meet the compliance requirements that require leaving traces; it can perform secondary processing of audio and video, which greatly improves the efficiency of external communication.

Today, with the rapid development of the Internet and WebRTC technology becoming increasingly mature, real-time audio and video communication will have more application scenarios and greater room for development. Qiniu RTN will continue to delve into the field of real-time audio and video, directly address the pain points of real-time audio and video development, and provide innovative technologies and high-quality solutions with more reference significance for customers in the audio and video industry.

Original text: Building a real-time audio and video platform based on WebRTC with zero foundation - Zhihu

★The business card at the end of the article allows you to receive free audio and video development learning materials, including (FFmpeg, webRTC, rtmp, hls, rtsp, ffplay, srs) and audio and video learning roadmap, etc.

See below! ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

 

Guess you like

Origin blog.csdn.net/yinshipin007/article/details/134894805