If you haven’t heard, WebRTC is _the _way to go for getting and sharing user’s video, audio, and other data in real time. Standing for Web Real Time Communication, it is the first of it’s kind — with JavaScript APIs for getting user’s media, creating peer-to-peer connections, and opening data channels right in the browser. Before the release of WebRTC in 2011, it required several developers and a lot of C# to accomplish these tasks.

Now, nearly 10 years later, WebRTC is the standard for web and mobile media sharing. Standardized by the World Wide Web Consortium (W3C) and the Internet Engineering Task Force (IETF), it has native support in HTML5, and is open-source and totally free. All this means that you can get started using it today without installing any plugins or packages.

In this post, I will walk you through the APIs that enable WebRTC to do all this work, and provide some simple code snippets to get you familiar with the datatypes and how to get started using them.

Note: there is a lot going on with WebRTC, especially with the peer connections and data channels. I will provide links throughout to learn more about these tools, their contexts, and some of the configurations needed to use them.

The Three WebRTC APIs

WebRTC makes use of three JavaScript APIs:

  1. MediaStream aka getUserMedia — allows developers access to user’s media streams: webcam, microphone, and screen (with the user’s permission, of course)
  2. RTCPeerConnection — enables audio and video “calling” between users via peer-to-peer connections
  3. RTCDataChannel — uses the peer-to-peer connection to enable real time sharing of any other generic data between users

#webrtc #javascript #video-chat

Introduction to WebRTC
8.85 GEEK