Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how does webRTC functionally work?

Is all the work for the webRTC functionality being done on a webRTC server ? For example, in the rtc data channel from simpl.info you can just copy the html for the input text box and out text box as well as the JavaScript and copy it to your local computer and it works perfectly. When the JavaScript file is inspected closer, there are a lot of calls which are coming from webRTC libraries without having them on my local computer. I.E.

window.localPeerConnection = new webkitRTCPeerConnection(servers,
{optional: [{RtpDataChannels: true}]});

at first I thought to get these methods to work I would have to download webRTC to the local machine that will be hosting the pages and then I can call them that way. But that does not seem to be the case, I have tried most of the examples and they all work without having webRTC locally.

I have watched the webRTC intro video it goes over a lot of the features but it doesnt explain this particular question. Another aspect that confuses me as well, is the fact when you go to the official webrtc.org getting started tutorial, it gives step by step instructions for download the webRTC libraries, which I did. But what is the purpose of that if you don't need to them to create webRTC apps and the work is being done in an outside server ?

I saw another question where the title is almost identical, how does webRTC work?, but after reading the accepted response and the question its different, OP wanted to know how the peer to peer connection worked and they explained to him ICE works and TURN servers, which I kinda understood from the intro video, my question is more are these turn servers, ICE, etc being hosted by Google or can we host them locally. And if its something Google hosts etc, isn't it unsafer than being able to host locally?

like image 716
Eduardo Dennis Avatar asked Dec 15 '13 16:12

Eduardo Dennis


People also ask

How does WebRTC work internally?

Audio and video in WebRTC works by using codecs. These are known algorithms that are used to compress and decompress audio and video data. There are different codecs you can use in WebRTC and I won't get into it now. Audio and video also gets interesting because it is sent with low latency in mind.

How does the WebRTC protocol work?

The "WebRTC" (Web Real-Time Communication) is an open-source protocol that allows real-time communication and data sharing between different browsers and devices. It allows sharing of voice, video, and data over the web. It is a protocol that sets two-way communication between two browsers in real-time.

How is WebRTC different?

WebRTC was built with bidirectional, real-time communication in mind. Unlike HLS, which is built with TCP, WebRTC is UDP-based. This means that WebRTC can start without requiring any handshake between the client and the server. As a result, WebRTC is speedier but also more susceptible to network fluctuations.

Does WebRTC use hole punching?

A technology known as "hole punching", among others, is also used. The servers make the session data which they use for communication with one of the remote stations available to the other remote station.


1 Answers

WebRTC is a very complex synergy of many components and protocols. Luckily, from a webdeveloper point of view, all of this is encapsulated by three main JavaScript API's: getUserMedia, RTCPeerConnection and RTCDataChannel. These API's are defined by the W3C and are part of the browser that support WebRTC. You can find an overview of the current support here:

  • getUserMedia
  • RTCPeerConnection
  • RTCDataChannel

This means that you do not have to "download" WebRTC to use it, if the browser supports it, it's already there.

To answer your second question about STUN and TURN servers: There are publicly available servers. However, these are mostly for testing purposes. You can deploy your own TURN server, rfc5766-turn-server is such one and documentation is found here

like image 124
Gnagy Avatar answered Sep 22 '22 13:09

Gnagy