# learn-WebRTC **Repository Path**: mirrors_dwyl/learn-WebRTC ## Basic Information - **Project Name**: learn-WebRTC - **Description**: :speech_balloon: Learn how to use WebRTC (Real-Time Communications) to connect browsers in real-time for faster (peer-to-peer) UX! - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-01-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Learn WebRTC (Real-Time Communications) ## Why? > One of the last major challenges for the web is to enable human communication via voice and video: Real Time Communication, RTC for short. RTC should be as natural in a web application as entering text in a text input. Without it, we're limited in our ability to innovate and develop new ways for people to interact. > Historically, RTC has been corporate and complex, requiring expensive audio and video technologies to be licensed or developed in house. Integrating RTC technology with existing content, data and services has been difficult and time consuming, particularly on the web. - [Html5Rocks introduction to WebRTC](https://www.html5rocks.com/en/tutorials/webrtc/basics/) WebRTC tries to address this challenge by providing a common platform for real-time communication on the web. It hands browsers the ability to directly communicate without relaying through a server. This in turn enables blazingly fast, _private_ (in WebRTC encrypted is mandatory) video and audio chat as well as peer-to-peer data transfer. ## What? WebRTC uses several JavaScript APIs to connect users and stream audio/video media: + getUserMedia() - creates video and audio streams from the user's webcam/mic. + RTCPeerConnection() - connects users :heart: + RTCDataChannel() - streams data between connected users Although WebRTC doesn't usually require a web server for its real-time communication, it does need one to 'introduce' users to each other (known as a _signaling server_). In our example we use [SimpleWebRTC](https://simplewebrtc.com/) to negate the need for a signaling server and to simplify the WebRTC interface. If you'd like to learn more about vanilla WebRTC API or want to run a signaling server of your own, check out the [Further Reading section](#reading) below. ## How? To get started with Web RTC stuff we are using [SimpleWebRTC](https://github.com/andyet/SimpleWebRTC/) which is a great library, it does all of the WebRTC configuration/handshake stuff for you so you can get on to making cool WebRTC stuff! It's still definitely worthwhile to learn the stuff under the hood, but SimpleWebRTC is a good way to start off. You can run our example to have a look at what you can make with SimpleWebRTC really easily. Just open example-complete/index.html in a browser, type in a nickname and a room name, and then open the same index.html again in another browser window, type in the same room name you used before, and another nickname, and you can talk to yourself using webRTC! If you prefer to read through the code, just open the index.html in your favourite text editor, it's commented throughout. If you prefer to have a walkthrough of how to set it up yourself, then follow along! The basis of this is SimpleWebRTC's great example of how to set up video chat, but adding in text chat as well. In order for WebRTC to work you need a turn server to match people up with eachother, SimpleWebRTC has one in as standard, but it is for development **only**. If you want to make a production app with it you will have to provide your own turn/stun server. ### Step 1. To start with take a look at the index.html in the example folder, note that it has a `