https://github.com/fmalcher/webrtc-minimal-example
A minimal WebRTC example
https://github.com/fmalcher/webrtc-minimal-example
Last synced: 5 months ago
JSON representation
A minimal WebRTC example
- Host: GitHub
- URL: https://github.com/fmalcher/webrtc-minimal-example
- Owner: fmalcher
- Created: 2015-11-24T00:34:43.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-06-27T10:16:07.000Z (about 9 years ago)
- Last Synced: 2025-08-15T14:55:27.612Z (11 months ago)
- Language: HTML
- Size: 207 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# webrtc-minimal-example
This is a very basic example for audio/video communication between two browsers.
It shall demonstrate how the WebRTC API works.
The example uses [SimpleMS](https://github.com/fmalcher/webrtc-simplems) as messaging server.
Feel free to fork or contribute! :smile:
> **It's a basic example! Error handling and features beyond basic communication have been dropped intentionally!**
# Getting Started (Example for Debian)
Install Node.js for the WebSocket server and a simple web server that serves the client app.
```
sudo apt-get install nodejs nodejs-legacy
sudo npm install -g http-server
```
Clone the repository.
```
git clone https://github.com/fmalcher/webrtc-minimal-example.git
cd webrtc-minimal-example
```
Edit the addresses in `helpers.js`:
* URL of the simplems server (`WEBSOCKET_URL`)
* URLs of STUN/TURN servers (in `RTCPC_CONFIG`)
```
$EDITOR helpers.js
```
Start the webserver.
```
http-server -S -K key.pem -C cert.pem
```
Open another terminal and clone and start the messaging server.
```
git clone https://github.com/fmalcher/webrtc-simplems.git
cd webrtc-simplems
npm install
node server.js
```
Open your Browser and go to `http://127.0.0.1:8080/`. You will see an error like in this picture after hitting F12.

Go ahead and open this URL in a new tab: `https://127.0.0.1:1337/` and confirm the security exception.

Don't worry, in this case it is local connection to your own computer.
The page will try to load but nothing will happen so close it. Reload the tab `http://127.0.0.1:8080/` again (F5). Then open another tab and type the same URL in. The rest is too simple to explain it.