0% found this document useful (0 votes)
94 views4 pages

WebRTC Allows You To Set Up Peer

WebRTC allows real-time communication between browsers through simple APIs. It uses peer-to-peer connections to transmit audio and video streams between users by handling encoding, transportation of packets, and session management. The main objects in the WebRTC API are RTCPeerConnection for setting up connections between peers, MediaStream for accessing the user's camera and microphone, and RTCDataChannel for sending additional data between users.

Uploaded by

jayaram_peggem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views4 pages

WebRTC Allows You To Set Up Peer

WebRTC allows real-time communication between browsers through simple APIs. It uses peer-to-peer connections to transmit audio and video streams between users by handling encoding, transportation of packets, and session management. The main objects in the WebRTC API are RTCPeerConnection for setting up connections between peers, MediaStream for accessing the user's camera and microphone, and RTCDataChannel for sending additional data between users.

Uploaded by

jayaram_peggem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

WebRTC is a free, open project that provides browsers and mobile applications with Real-Time

Communications (RTC) capabilities via simple APIs.


WebRTC allows you to set up peer-to-peer connections to other web browsers quickly and easily.

The first step is to get access to the camera and microphone of the user's device. We detect the
type of devices available, get user permission to access these devices and manage the stream.

Encoding and Decoding Audio and Video


This is the process of splitting up video frames and audio waves into smaller chunks and
compressing them. This algorithm is called codec. There is an enormous amount of different
codecs, which are maintained by different companies with different business goals. There are also
many codecs inside WebRTC like H.264, iSAC, Opus and VP8. When two browsers connect
together, they choose the most optimal supported codec between two users. Fortunately, WebRTC
does most of the encoding behind the scenes.

Transportation Layer
The transportation layer manages the order of packets, deal with packet loss and connecting to
other users. Again the WebRTC API gives us an easy access to events that tell us when there are
issues with the connection.

Session Management
The session management deals with managing, opening and organizing connections. This is
commonly called signaling. If you transfer audio and video streams to the user it also makes
sense to transfer collateral data. This is done by the RTCDataChannel API.

Engineers from companies like Google, Mozilla, Opera and others have done a great job to bring
this real-time experience to the Web.

Browser Compatibility
The WebRTC standards are one of the fastest evolving on the web, so it doesn't mean that every
browser supports all the same features at the same time. To check whether your browser supports
WebRTC or not, you may visit http://caniuse.com/#feat=rtcpeerconnection. Throughout all the
tutorials, I recommend you to use Chrome for all the examples.

Click the “Allow” button to start streaming your video and audio to the web page. You should
see a video stream of yourself.

Now open the URL you are currently on in a new browser tab and click on “JOIN”. You should
see two video streams − one from your first client and another from the second one.
Advertisements
The WebRTC API
It consists of a few main javascript objects −

 RTCPeerConnection
 MediaStream
 RTCDataChannel
The RTCPeerConnection object
This object is the main entry point to the WebRTC API. It helps us connect to peers, initialize
connections and attach media streams. It also manages a UDP connection with another user.
The main task of the RTCPeerConnection object is to setup and create a peer connection. We can
easily hook keys points of the connection because this object fires a set of events when they
appear. These events give you access to the configuration of our connection −

MediaStream API
Modern browsers give a developer access to the getUserMedia API, also known as
the MediaStream API. There are three key points of functionality −

 It gives a developer access to a stream object that represent video and audio streams

 It manages the selection of input user devices in case a user has multiple cameras or
microphones on his device

 It provides a security level asking user all the time he wants to fetch s stream

The RTCDataChannel object


As well as sending media streams between peers, you may also send additional data
using DataChannel API.

You might also like