At present, there are two implementations of real-time audio and video communication in the browser, respectively H5 and WebRTC, the former can be pulled stream to watch, the latter can be pushed stream and pull stream.

The body of the

H5 and WebRTC are two options for real-time audio and video communication on the browser, but there are obvious differences between them, and the pros and cons are also prominent.

H5 real-time communication scheme

Browser H5 real-time solution has obvious advantages and disadvantages, the advantage is the development cost is relatively low, the development cycle is short, the disadvantage is only pull flow, can not push the flow, can not achieve interactive continuous mic. In addition, browser H5 scheme latency is relatively large.

If the RTMP or HTTP-FLV protocol is used, the delay will be between 1 second and 3 seconds. If the HLS protocol is used, the delay will be larger. Of course, a lower delay can be achieved by limiting the TS fragment size. However, for scenarios such as large classes and conferences, the above media protocols are appropriate because the audio and video streams are unidirectional and there is no latency perception.

Real-time communication solution of WebRTC

Although the browser H5 solution is very common and easy to develop, it can not be broadcast with mic. So is it possible to do live streaming on the browser? The answer is yes, it is WebRTC. The peer-to-peer (P2P) real-time communication solution was first initiated by Google, and has been widely verified in Chrome for a long time. Many browsers now support WebRTC.

WebRTC includes audio engine, video engine, transmission engine, etc. Among them, audio engine includes two codecs: iSAC and iLBC. The former is for broadband and uWB audio codec, and the latter is for narrowband audio codec, which is actually Opus audio codec. The audio engine also includes echo cancellation, noise suppression and automatic gain modules. The video engine includes VP8 and VP9 video codecs, and Google is currently planning to launch AV1. The video engine also includes video jitter buffer and image quality enhancement modules. With a Transport engine, WebRTC uses Secured Realtime Transport Protocol (SRTP) for Secured audio and video transmission in Realtime. The key generation depends on the negotiation process of DTLS protocol.

Likewise, the browser WebRTC solution has its drawbacks:

1) There is no custom module setting interface, so good beauty and texture effects cannot be achieved in the browser.

2) WebRTC does not have a unified signaling standard, which on the one hand gives the technical solution flexibility, and on the other hand causes the conversion cost when multiple systems interwork.

3) Audio coding format and video coding format must rely on WebRTC and cannot be customized.

4) Many streaming browsers support WebRTC is not very friendly, there are differences.