What is WebRTC and how to disable it. Peer-to-peer video chat based on WebRTC Webrtc working examples

The purpose of this article is to familiarize yourself with its structure and operation principle using a demo sample of peer-to-peer video chat (p2p video chat). For this purpose, we will use the webrtc.io-demo multiuser video chat demo. It can be downloaded from the link: https://github.com/webRTC/webrtc.io-demo/tree/master/site.

It should be noted that GitHub is a site or web service for collaborative development of Web projects. On it developers can post codes for their developments, discuss them and communicate with each other. In addition, some large IT companies host their official repositories on this site. The service is free for open source projects. GitHub is a repository of open source, free source libraries.

So, we will place the demo sample of peer-to-peer video chat downloaded from GitHub on the C drive of a personal computer in the created directory for our application "webrtc_demo".


Figure: 1

As follows from the structure (Fig. 1), peer-to-peer video chat consists of client script.js and server-side server.js scripts, implemented in the JavaScript programming language. The script (library) webrtc.io.js (CLIENT) - provides the organization of real-time communication between browsers on a peer-to-peer scheme: "client-client", and webrtc.io.js (CLIENT) and webrtc.io.js (SERVER), using the WebSocket protocol, they provide full-duplex communication between the browser and the web server in a "client-server" architecture.

The webrtc.io.js (SERVER) script is included in the webrtc.io library and is located in the node_modules \\ webrtc.io \\ lib directory. The index.html video chat interface is implemented in HTML5 and CSS3. The contents of the webrtc_demo application files can be viewed with one of the html editors, for example "Notepad ++".

We will check the principle of video chat in file system PC. To run the server (server.js) on the PC, you need to install the node.js runtime. Node.js allows JavaScript code to run outside the browser. You can download node.js from the link: http://nodejs.org/ (version v0.10.13 on 07/15/13). On the main page of node.org, click on the download button and go to http://nodejs.org/download/. For windows users, first download win.installer (.msi), then run win.installer (.msi) on a PC, and install nodejs and "npm package manager" into the Program Files directory.




Figure: 2

Thus, node.js consists of a development and execution environment for JavaScript code, as well as a set of internal modules that can be installed using the npm package manager or manager.

To install modules you need to command line from the application directory (for example, "webrtc_demo") execute the command: npm install module_name... During the installation of modules, the npm manager creates a node_modules folder in the directory from which the installation was performed. In the process, nodejs automatically connects modules from the node_modules directory.

So, after installing node.js, open the command line and update the express module in the node_modules folder of the webrtc_demo directory using the npm package manager:

C: \\ webrtc_demo\u003e npm install express

The express module is a web framework for node.js or a web framework for developing applications. To have global access to express, you can install it like this: npm install -g express.

Then we update the webrtc.io module:

C: \\ webrtc_demo\u003e npm install webrtc.io

Then, on the command line, start the server: server.js:

C: \\ webrtc_demo\u003e node server.js


Figure: 3

Everything, the server is working successfully (Figure 3). Now, using a web browser, you can access the server by ip address and download the index.html web page, from which the web browser will extract the client script code - script.js and the webrtc.io.js script code, and execute them. For peer-to-peer video chat to work (to establish a connection between two browsers), it is necessary from two browsers that support webrtc to contact the signaling server running on node.js by the ip-address.

As a result, the interface of the client part of the communication application (video chat) will open with a request for permission to access the camera and microphone (Fig. 4).



Figure: 4

After clicking the "Allow" button, the camera and microphone are connected for multimedia communication. In addition, textual data can be communicated through the video chat interface (Fig. 5).



Figure: five

It should be noted that. The server is signaling, and is mainly intended to establish a connection between users' browsers. Node.js is used to run the server.js script that provides WebRTC signaling.

WebRTC (short for Web real-time communications) is a technology that allows audio and video streaming between browsers and mobile applications.


The development of this technology competes with Skype. WebRTC can be used to organize video conferencing directly in the browser. The project is open source and is actively promoted by Google and in particular by the browser development team Google chrome.


User browsers thanks webRTC technologies can transfer data to each other directly. WebRTC doesn't need a separate server to store and process data. All data is processed directly by browsers and mobile applications of end users.


WebRTC technology is supported by all popular browsers Mozilla Firefox, Opera, Google Chrome (and all browsers on google base Chrome), as well as mobile apps on android base and iOS.

Danger of WebRTC

The danger of WebRTC technology lies in determining your real IP address. Since the connection goes directly to another user, browser, website or mobile application, the network settings are ignored. To create audio and video links, browsers must exchange external and local IP addresses.

Anonymous VPN service solves this problem and hides the real IP address. The maximum that can be detected is the local IP address assigned to the user by the VPN network. This is not dangerous, as the same local IP addresses will be shown if you are using a router to distribute the Internet.


If you are using a proxy, then WebRTC will be able to determine your real IP address behind the proxy, or the IP address of the VPN server if you are using the VPN + proxy chain.


WebRTC also detects your real IP address when using the Tor network.


The most the best decision - disable WebRTC technology if you don't use it.

How to disable WebRTC in browsers

Quick navigation on this page.

How to disable WebRTC in Mozilla Firefox

Mozilla Firefox is the only browser that allows you to disable WebRTC technology without installing additional plugins.

Manual setting

If you are not using WebRTC technology, you can completely disable it. In the case when it is necessary to use WebRTC periodically it is more convenient.

To disable WebRTC technology in Mozilla Firefox, enter the following text in the browser address bar and press the Enter button.

About: config


Click the button I accept the risk.


Do the following:

  1. Enter text into the search box and press Enter.
  2. media.peerconnection.enabled
  3. Right-click on the line and select Switch. Or double click on the line.


After these steps, WebRTC will be disabled.

Configuration via the WebRTC Control plugin

If you use WebRTC technology, then disabling and enabling through the settings will take a long time. Install a plugin that will help you enable and disable WebRTC in 1 click.

Open Add-ons.


Select:

  1. Search section
  2. Enter the plugin name into the search box: WebRTC Control
  3. Click the Install button


How to disable WebRTC in Opera browser

To disable WebRTC in opera browser go to the Extensions gallery.


Follow these steps:

  1. Enter the plugin name in the search bar: WebRTC Control
  2. Click on plugin


Click Add to Opera.


Activate the plugin. The plugin icon should turn blue to block WebRTC.

How to disable WebRTC in Google Chrome

To disable WebRTC in the Google Chrome browser, go to the Extensions section.


Scroll down the page and click More extensions.


Follow these steps:

  1. Enter the plugin name in the search box: WebRTC Control
  2. Click the Install button.



Activate the plugin. The plugin icon should turn blue to block WebRTC.

How to disable WebRTC in Yandex Browser

To disable WebRTC in Yandex Browser, go to the Add-ons section.


Scroll down the page and click on Yandex Browser extensions catalog.


Follow the steps:

  1. Enter the plugin name in the search bar: WebRTC Control
  2. Click on the plugin to install.


Click Add to Yandex Browser.


Click Install Extension.


Activate the plugin. The plugin icon should turn blue to block WebRTC.

How to disable WebRTC in SRWare Iron browser

SRWare Iron browser is based on Google Chrome.

Install the WebRTC Control plugin according to the instructions for.

WebRTC (Web Real-Time Communications) is a technology that allows Web applications and sites to capture and selectively transmit audio and / or video media streams, as well as exchange arbitrary data between browsers, without the need for intermediaries. The set of standards that WebRTC technology includes allows data exchange and peer-to-peer teleconferencing without the need for the user to install plugins or any other third-party software.

WebRTC is made up of several interconnected programming interfaces (APIs) and protocols that work together. The documentation you find here will help you understand the basics of WebRTC, how to set up and use a data and media stream connection, and more.

Compatibility

Since the implementation of WebRTC is in the making and every browser has WebRTC functions, we strongly recommend using the Adapter.js polyfill library from Google before starting to work on your code.

Adapter.js uses wedges and polyfills to seamlessly join differences in WebRTC implementations among the contexts that support it. Adapter.js also handles vendor prefixes and other property naming differences, making it easier to develop with WebRTC, with the most consistent result. The library is also available as an NPM package.

For further exploration of the Adapter.js library, take a look.

Concepts and usage of WebRTC

WebRTC is multipurpose and, together with, provides powerful multimedia capabilities for the Web, including support for audio and video conferencing, file sharing, screen capture, identity management, and interoperability with legacy telephony systems, including support for DTMF tone dialing. Connections between nodes can be created without using special drivers or plugins, and often without intermediate services.

The connection between the two nodes is represented as an object of the RTCPeerConnection interface. Once a connection is established and opened using the RTCPeerConnection object, media streams (MediaStream s) and / or data channels (RTCDataChannel s) can be added to the connection.

Media streams can consist of any number of media tracks (tracks). These tracks, represented by objects in the MediaStreamTrack interface, can contain one or more types of media, including audio, video, text (such as subtitles or chapter titles). Most streams consist of at least one audio track (one audio track), or video track, and can be sent and received as streams (real-time media) or saved to a file.

Also, you can use the connection between two nodes to exchange arbitrary data using the RTCDataChannel interface object, which can be used to transfer service information, exchange data, game status packets, file transfer or closed data transfer channels.

more details and links to relevant guides and tutorials needed

WebRTC interfaces

Due to the fact that WebRTC provides interfaces that work together to perform various tasks, we have divided them into categories. See the sidebar alphabetical index for quick navigation.

Connection setup and management

These interfaces are used to configure, open and manage WebRTC connections. They represent peer-to-peer media connections, data channels, and interfaces used to exchange information about the capabilities of each node to select the best configuration for establishing a two-way multimedia connection.

RTCPeerConnection Represents the WebRTC connection between local computer and a remote host. Used to handle successful data transfer between two nodes. RTCSessionDescription Represents session parameters. Each RTCSessionDescription contains a description of the type showing which part (offer / response) of the negotiation process it describes, and an SDP-descriptor for the session. RTCIceCandidate This is an Internet Connection Establishment (ICE) server candidate for establishing an RTCPeerConnection. RTCIceTransport Represents information about an Internet Connectivity Tool (ICE). RTCPeerConnectionIceEvent Represents events that occur for ICE candidates, usually RTCPeerConnection. One type is passed to this event object: icecandidate. RTCRtpSender Controls crawling and data transfer through an object of type MediaStreamTrack for an object of type RTCPeerConnection. RTCRtpReceiver Controls the receipt and decoding of data through a MediaStreamTrack object for an RTCPeerConnection object. RTCTrackEvent Indicates that a new incoming MediaStreamTrack object has been created and an RTCRtpReceiver object has been added to the RTCPeerConnection object. RTCCertificate Represents a certificate that uses an RTCPeerConnection object. RTCDataChannel Represents a bi-directional data channel between two connection nodes. RTCDataChannelEvent Represents the events that are raised when an RTCDataChannel object is attached to an RTCPeerConnection datachannel object. RTCDTMFSender Controls the encoding and transmission of dual tone multi-frequency (DTMF) signaling for an RTCPeerConnection object. RTCDTMFToneChangeEvent Indicates an inbound Dual Tone Multi-Frequency (DTMF) tone change event. This event does not bubble (unless otherwise noted) and is not canceled (unless otherwise noted). RTCStatsReport Asynchronously reports the status for the passed object of type MediaStreamTrack. RTCIdentityProviderRegistrar Registers an identity provider (idP). RTCIdentityProvider Enables the browser to request the creation or validation of an identity declaration. RTCIdentityAssertion Represents the remote host ID of the current connection. If the node is not yet set and verified, the interface reference will return null. Does not change after installation. RTCIdentityEvent Represents an identity declaration by an identity provider (idP) event object. Event of an object of type RTCPeerConnection. One type is passed to this event, identityresult. RTCIdentityErrorEvent Represents an error event object associated with an identity provider (idP). Event of an object of type RTCPeerConnection. Two types of error are passed to this event: idpassertionerror and idpvalidationerror.

Manuals

Overview of the WebRTC Architecture Underneath the API that developers use to create and use WebRTC is a set network protocols and connection standards. This overview is a showcase of these standards. WebRTC allows you to establish a host-to-host connection for transferring arbitrary data, audio, video streams, or any combination of these in a browser. In this article, we will take a look at the life of a WebRTC session, starting with establishing a connection and going all the way until it ends when it is no longer needed. Overview of WebRTC API WebRTC consists of several interconnected programming interfaces (APIs) and protocols that work together to provide support for exchanging data and media streams between two or more nodes. This article provides a quick overview of each of these APIs and what their purpose is. WebRTC Basics This article walks you through building a cross-browser RTC application. By the end of this article, you should have a working point-to-point data and media feed. WebRTC Protocols This article introduces the protocols, in addition to which the WebRTC API has been created. This guide describes how you can use a node-to-node connection and a linked

Hi friends, as you already know, we inform you regularly about new technologies, today I will introduce WebRTC, a technology developed by Google that allows users to speak directly in the browser video and audio without requiring that the use of plugin websites or applications. Video and audio direct connection between users takes place directly in the browser.
WebRTC technology is supported in Mozilla Firefox browsers Google Chrome and on any operating system, Opera will be joining soon.
What is WebRTC and what?
WebRTC is short for Web Real Time Comunication, this technology allows you to open audio and video chats directly in the browser without the need for other plugins, applications or services on the Internet for this. The connection is made directly from the browser to the browser.
Where well-known services (Skype, Yahoo Messenger, Apple FaceTime, Google Hago, etc.) require a server that connects users to initiate and control traffic. Using these services we need to register and have established a list of clients and contacts.
With WebRTC, we don't need any servers, apps, or servers that connect to intercede.
WebRTC benefits:
1. No more apps consuming resource and battery usage.
2. Chat rooms are more private (relatively).
3. How to contact can be done locally, not flos US servers for local connections.
4. Simplicity, ease of use.
5. Possibility of further development, and in other directions.
6. Communication is stable and does not depend on external connections, which are sometimes extremely unstable.
In the tutorial, I used a demo that people at Google have developed, this demo is quite simple, more advanced features and faster connections can use one of the apps that support WebRTC, they are easier to use. We will be doing a tutorial about WebRTC applications soon.
How to use the WebRTC demo?
Very simple click on the link below, it will automatically generate a chat. to link this room, you must send the boyfriend / girlfriend you want to get in touch.
Friend / girlfriend and yours, but you should only use the most latest versions Mozilla Firefox or Google Chrome.

Demo WebRTC (Introductory chat audio - video)

Attention:
The demo is not very stable, it is produced for demonstration purposes only. It can be used for a limited period of time, during which small connection errors may occur.
If you have connection problems, try creating another chat.

WebRTC (Web Real Time Communications) is a standard that describes the transfer of streaming audio data, video data, and content from and to the browser in real time without installing plugins or other extensions. The standard allows you to turn your browser into an endpoint for video conferencing, you just need to open a web page to start chatting.

What is WebRTC?

In this article, we'll go over everything there is to know about WebRTC technology for the average user. Let's consider the advantages and disadvantages of the project, reveal some secrets, tell how it works, where and what WebRTC is used for.

What you need to know about WebRTC?

Evolution of video communication standards and technologies

Sergey Yutsaitis, Cisco, Video + Conference 2016

How WebRTC works

Client side

  • User opens a page containing HTML5 tag
  • The browser requests access to the user's webcam and microphone.
  • JavaScript code on the user page controls connection parameters (IP addresses and ports of the WebRTC server or other WebRTC clients) for NAT and Firewall traversal.
  • Upon receiving information about the interlocutor or about the stream with the conference mixed on the server, the browser starts negotiating the audio and video codecs used.
  • The encoding process begins and the transfer of streaming data between WebRTC clients (in our case, between the browser and the server).

On the WebRTC server side

To exchange data between two participants, a video server is not required, but if you need to combine several participants in one conference, a server is required.



The video server will receive media traffic from various sources, transform it and send it to users who use WebRTC as a terminal.

Also, the WebRTC server will receive media traffic from WebRTC peers and transmit it to conference participants who use applications for desktop computers or mobile devices, if any.

Advantages of the standard

  • No software installation required.
  • Very high quality of communication, thanks to:
    • Using modern video (VP8, H.264) and audio codecs (Opus).
    • Automatic adjustment of stream quality for connection conditions.
    • Built-in echo and noise cancellation system.
    • Automatic adjustment of the participant microphone sensitivity level (AGC).
  • High level of security: all connections are secured and encrypted according to TLS and SRTP protocols.
  • There is a built-in mechanism for capturing content, such as the desktop.
  • 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.
  • Open source project - can be embedded in your product or service.
  • True cross-platform: the same WebRTC application will work equally well on any operating system, desktop or mobile, provided that the browser supports WebRTC. This significantly saves software development resources.

Disadvantages of the standard

  • To organize group audio and video conferencing, a video conferencing server is required, which would mix video and sound from the participants. the browser cannot synchronize multiple incoming streams with each other.
  • All WebRTC solutions are incompatible with each other. the standard describes only the methods of transmitting video and sound, leaving the implementation of methods for addressing subscribers, tracking their availability, exchanging messages and files, scheduling and other things for the vendor.
  • In other words, you cannot call from one developer's WebRTC application to another developer's WebRTC application.
  • Mixing group conferences requires a lot of computational resources, so this type of video communication requires a purchase paid subscription or investing in your infrastructure, where each conference requires 1 physical core of a modern processor.

WebRTC Secrets: How Vendors Benefit From Disruptive Web Technology


Tsachi Levent-Levy, Bloggeek.me, Video + Conference 2015

WebRTC for the video conferencing market

Increase in the number of videoconferencing terminals

WebRTC technology has had a strong impact on the development of the video conferencing market. After the release of the first WebRTC-enabled browsers in 2013, the potential number of video conferencing terminals around the world immediately increased by 1 billion devices. In fact, each browser has become a video conferencing terminal that is not inferior to its hardware counterparts in terms of communication quality.

Use in specialized solutions

Using various JavaScript libraries and cloud service APIs with WebRTC support makes it easy to add video support to any web projects. Previously, to transfer data in real time, developers had to study the principles of the protocols and use the developments of other companies, which most often required additional licensing, which increased costs. Already, WebRTC is actively used in services such as “Call from the site”, “Online support chat”, etc.

Ex-Skype users for Linux

In 2014, Microsoft announced that it was ending support for the Skype for Linux project, which caused great irritation among IT professionals. WebRTC technology is not tied to the operating system, but is implemented at the browser level, i.e. Linux users will be able to see a full replacement for Skype in products and services based on WebRTC.

Competition with Flash

WebRTC and HTML5 were a fatal blow to Flash technology, which was far from outliving its best years... Since 2017, the leading browsers have officially stopped supporting Flash and the technology has completely disappeared from the market. But we must give Flash its due, because it was he who created the web conferencing market and offered the technical possibilities for live communication in browsers.

WebRTC video presentations

Dmitry Odintsov, TrueConf, Video + Conference October 2017

Codecs in WebRTC

Audio codecs

To compress audio traffic, WebRTC uses Opus and G.711 codecs.

G.711 - the oldest high bitrate voice codec (64 kbps), which is most often used in systems traditional telephony... The main advantage is the minimum computational load due to the use of lightweight compression algorithms. The codec has a low level of compression of voice signals and does not introduce additional audio delay during communication between users.

G.711 is supported by many devices. Systems that use this codec are easier to use than those based on other audio codecs (G.723, G.726, G.728, etc.). In terms of quality, G.711 scored 4.2 in MOS testing (a score of 4-5 is the highest and means good quality, similar to the quality of voice traffic transmission in ISDN and even higher).

Opus Is a low latency encoding (2.5ms to 60ms) codec with variable bit rate support and high compression, ideal for streaming audio over variable frequency networks. throughput... Opus is a hybrid solution that combines best performance codecs SILK (voice compression, elimination of distortion of human speech) and CELT (audio coding). The codec is freely available, developers who use it do not need to pay royalties to the copyright holders. Compared to other audio codecs, Opus undoubtedly outperforms in many ways. It has eclipsed the fairly popular low bitrate codecs such as MP3, Vorbis, AAC LC. Opus restores the “picture” of sound closer to the original than AMR-WB and Speex. This codec is the future, which is why the creators of the WebRTC technology have included it in the mandatory range of supported audio standards.

Video codecs

The questions of choosing a video codec for WebRTC took several years from the developers, in the end they decided to use H.264 and VP8. Almost all modern browsers support both codecs. Video conferencing servers need only support one to work with WebRTC.

VP8 - a free video codec with an open license, has a high decoding speed of the video stream and increased resistance to frame loss. The codec is universal, it is easy to implement in hardware platforms, therefore, very often developers of video conferencing systems use it in their products.

Paid video codec H.264 became known much earlier than his brother. It is a highly compressed video stream codec while saving high Quality video. The high prevalence of this codec among hardware video conferencing systems suggests its use in the WebRTC standard.

Google and Mozilla are actively promoting the VP8 codec, while Microsoft, Apple and Cisco are promoting H.264 (for compatibility with traditional video conferencing systems). And here a very big problem arose for developers of cloud-based WebRTC solutions, because if all participants in a conference use one browser, then the conference needs to be mixed once with one codec, and if the browsers are different and there is Safari / Edge among them, then the conference will have to be coded twice different codecs, which will double system requirements to the media server and, as a result, the cost of subscriptions to WebRTC services.

WebRTC API

WebRTC technology is based on three main APIs:

  • (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 “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 and video codecs used) ...
  • RTCData Channel (provides two-way data transmission over an established connection).

The browser asks for permission before accessing the user's microphone and camera. In Google Chrome, you can pre-configure access in the "Settings" section, in Opera and Firefox devices are selected directly at the time of access, from the drop-down list. A request for permission will appear always when using the HTTP protocol and once if using HTTPS:


RTCPeerConnection... Each browser participating in the WebRTC conference must have access to this object. By using RTCPeerConnection, media from one browser to another can even pass through NATs and firewalls. For the successful transmission of media streams, participants must exchange the following data using a transport, for example, web sockets:

  • the initiating participant sends to the second participant the Offer-SDP (data structure with the characteristics of the media stream that it will transmit);
  • the second participant forms an “answer” - Answer-SDP and sends it to the initiator;
  • then an exchange of ICE candidates is organized between the participants, if any are found (if the participants are behind NAT or firewalls).

After the successful completion of this exchange between the participants, the direct transfer of media streams (audio and video) is organized.

RTCData Channel... Support for the Data Channel protocol appeared in browsers relatively recently, so this API can be considered exclusively in cases of using WebRTC in Mozilla Firefox 22+ and Google Chrome 26+ browsers. With its help, participants can exchange text messages in the browser.

Connection via WebRTC

Supported desktop browsers

  • Google Chrome (17+) and all browsers based on the Chromium engine;
  • Mozilla FireFox (18+);
  • Opera (12+);
  • Safari (11+);

Supported mobile browsers for Android

  • Google Chrome (28+);
  • Mozilla Firefox (24+);
  • Opera Mobile (12+);
  • Safari (11+).

WebRTC, Microsoft and Internet Explorer

For a very long time, Microsoft was silent about WebRTC support in Internet Explorer and in its new browser Edge. The guys from Redmond are not very fond of putting technologies that they do not control into the hands of users, this is the policy. But gradually the matter got off the ground, tk. it was no longer possible to ignore WebRTC any longer, and the ORTC project, derived from the WebRTC standard, was announced.

According to the developers, ORTC is an extension of the WebRTC standard with an improved set of APIs based on JavaScript and HTML5, which translated into ordinary language means that everything will be the same, only Microsoft will control the standard and its development, not Google. The set of codecs has been expanded with support for H.264 and some G.7XX series audio codecs used in telephony and hardware video conferencing systems. Perhaps there will be built-in support for RDP (for content transfer) and messaging. By the way, Internet Explorer users are out of luck, ORTC support will only be in Edge. And, of course, such a set of protocols and codecs with little blood docks with Skype for Business, which opens up even more business applications for WebRTC.