Files
upstream-pion-webrtc/examples/swap-tracks/README.md
upstream-mirror 8acb1a3a29
Some checks failed
REUSE Compliance Check / lint (push) Failing after 0s
Browser E2E / Test (push) Failing after 3s
Test / test (1.24) (push) Failing after 0s
Test / test-i386 (1.25) (push) Failing after 0s
Test / test-i386 (1.24) (push) Failing after 0s
Test / test-windows (1.25) (push) Failing after 0s
Test / test-windows (1.24) (push) Failing after 0s
Test / test (1.25) (push) Failing after 0s
Examples Tests / Test (push) Failing after 3s
Test / test-macos (1.25) (push) Failing after 0s
Test / test-macos (1.24) (push) Failing after 0s
Go mod tidy / tidy (push) Failing after 0s
Test / test-wasm (push) Failing after 0s
CodeQL / analyze (push) Failing after 1s
Fuzz / fuzz (push) Failing after 0s
snapshot of https://github.com/pion/webrtc.git (main, 2026-09-15; blobs > 131072B omitted)
2026-09-15 20:06:07 +05:00

30 lines
1.1 KiB
Markdown

# swap-tracks
swap-tracks demonstrates how to swap multiple incoming tracks on a single outgoing track.
## Instructions
### Download swap-tracks
```
go install github.com/pion/webrtc/v4/examples/swap-tracks@latest
```
### Open swap-tracks example page
[jsfiddle.net](https://jsfiddle.net/1rx5on86/) you should see two text-areas and two buttons: `Copy browser SDP to clipboard`, `Start Session`.
### Run swap-tracks, with your browsers SessionDescription as stdin
In the jsfiddle the top textarea is your browser's Session Description. Press `Copy browser SDP to clipboard` or copy the base64 string manually.
We will use this value in the next step.
#### Linux/macOS
Run `echo $BROWSER_SDP | swap-tracks`
#### Windows
1. Paste the SessionDescription into a file.
1. Run `swap-tracks < my_file`
### Input swap-tracks's SessionDescription into your browser
Copy the text that `swap-tracks` just emitted and copy into second text area
### Hit 'Start Session' in jsfiddle, enjoy your video!
Your browser should send streams to Pion, and then a stream will be relayed back, changing every 5 seconds.
Congrats, you have used Pion WebRTC! Now start building something cool