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