What functions can WebRTC bring to Telegram

In early July, references to the WebRTC library were found in the source code of Telegram for iOS, with which developers can add regular and group video calls to the messenger. At the moment, video calls have already been implemented using this technology in the iOS client, and are being developed in applications for Android, macOS, and Telegram Desktop.

WebRTC (Web Real Time Communications) is a standard for transmitting streaming audio, video data and content from application to application (or browser) in real time without installing plugins or other extensions.

Functions that can be done based on WebRTC

The real-time web opens up access to a whole host of new uses, including screencasting, file sharing, gaming, video chat and more. Besides communicating, WebRTC can be used for other purposes:

  • real-time marketing;
  • dating services;
  • online medical consultations;
  • Financial services;
  • observation;
  • multiplayer games;
  • live broadcasts;
  • e-learning.

Which of the above can fit well into the messenger, we will consider below.

Screen demonstration

In addition to ordinary video calls, you can display the screen, both in personal and group calls, the range of application of this function is wide enough and can be used both in training and in work or bloggers.

Access to the device

The ability to remotely control the device (if the owner has allowed it), in other words, a replacement for Team Viewer.

Live broadcasts for channels

Since the library allows you to transfer pictures and videos in real time, this will help create video content in real time, which will allow you to use the messenger in even more areas and make it more attractive for broadcasting events, games, appeals, bloggers, etc.

Cloud gaming on WebRTC

As you know, Telegram has its own gaming platform, which has not been updated since its inception. WebRTC can be what will help take it to the next level, p2p, multiplayer, and almost zero latency in data transmission. Learn more about open source cloud gaming on WebRTC.

Technology

WebRTC uses two audio codecs, G.711 and Opus, as well as VP8 and H.264 video codecs

Technology advantages

  • Automatic adjustment of stream quality for connection conditions.
  • Built-in echo and noise cancellation system.
  • The used codecs provide good quality of communication.
  • The ability to implement any interface elements using HTML5 and JavaScript.
  • Open source provides more options for use.
  • The ability to implement any control interface based on HTML5 and JavaScript.
  • The ability to integrate the interface with any back-end systems using WebSockets.
  • True cross-platform: the same WebRTC application will work equally well on any operating system — desktop or mobile, provided that the browser supports WebRTC.

WebRTC API
WebRTC technology is based on three main APIs:

  • MediaStream (responsible for accepting audio and video signals from cameras or the user’s desktop by the web browser).
  • RTCPeerConnection (responsible for the connection between browsers for the “exchange” of media data received from the camera, microphone and desktop. Also, the “duties” of this API include signal processing (cleaning it from extraneous noise, adjusting the microphone volume) and control over the audio used and video codecs).
  • RTCData Channel (provides bi-directional data transmission over an established connection).