1# broadcast
2broadcast is a WebRTC.rs application that demonstrates how to broadcast a video to many peers, while only requiring the broadcaster to upload once.
3
4This could serve as the building block to building conferencing software, and other applications where publishers are bandwidth constrained.
5
6## Instructions
7### Build broadcast
8```
9cargo build --example broadcast
10```
11
12### Open broadcast example page
13[jsfiddle.net](https://jsfiddle.net/1jc4go7v/) You should see two buttons 'Publish a Broadcast' and 'Join a Broadcast'
14
15### Run Broadcast
16#### Linux/macOS
17Run `broadcast`
18
19### Start a publisher
20
21* Click `Publish a Broadcast`
22* Copy the string in the first input labelled `Browser base64 Session Description`
23* Run `curl localhost:8080/sdp -d "$BROWSER_OFFER"`. `$BROWSER_OFFER` is the value you copied in the last step.
24* The `broadcast` terminal application will respond with an answer, paste this into the second input field in your browser.
25* Press `Start Session`
26* The connection state will be printed in the terminal and under `logs` in the browser.
27
28### Join the broadcast
29* Click `Join a Broadcast`
30* Copy the string in the first input labelled `Browser base64 Session Description`
31* Run `curl localhost:8080/sdp -d "$BROWSER_OFFER"`. `$BROWSER_OFFER` is the value you copied in the last step.
32* The `broadcast` terminal application will respond with an answer, paste this into the second input field in your browser.
33* Press `Start Session`
34* The connection state will be printed in the terminal and under `logs` in the browser.
35
36You can change the listening port using `-port 8011`
37
38You can `Join the broadcast` as many times as you want. The `broadcast` application is relaying all traffic, so your browser only has to upload once.
39
40Congrats, you have used WebRTC.rs!
41