Skip to content

Commit 5128eda

Browse files
Merge pull request #124 from s074/pion-docs
add docs for pion webrtc
2 parents 4d48024 + 9f54307 commit 5128eda

2 files changed

Lines changed: 61 additions & 8 deletions

File tree

docs/setup/server/voice.md

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,23 @@
22

33
**Currently only WebRTC connections are supported. UDP connections will be dropped**
44

5-
Voice support is left as an optional dependency in {{ project.name }}, which means that it is disabled by default unless you decide to install additional dependencies. {{ project.name }} is designed so that anyone can develop a voice package compatible with the project as long as the implementation adheres to the [WebRTC types]({{ repositories.base_url }}/{{ repositories.voice_types }}). Currently there are two sample implementations which can be used:
6-
7-
- [Medooze Implementation]({{ repositories.base_url }}/{{ repositories.voice_medooze }}) - Supports video&audio for guild voice, DM voice, as well as GoLive streams. Only supports Linux & MacOS environments.
8-
- [Mediasoup Implementation]({{ repositories.base_url }}/{{ repositories.voice_mediasoup }}) - Supports audio only for guild voice, DM voice, and GoLive streams. Supports Windows, Linux, and MacOS environments
5+
Voice support is left as an optional dependency in {{ project.name }}, which means that it is disabled by default unless you decide to install additional dependencies. {{ project.name }} is designed so that anyone can develop a voice package compatible with the project as long as the implementation adheres to the [WebRTC types]({{ repositories.base_url }}/{{ repositories.voice_types }}). Currently there are three sample implementations which can be used:
6+
7+
- (**Recommended**) [Pion Implementation]({{ repositories.base_url }}/{{repositories.voice_pion }}) - Golang SFU which is bridged via IPC to communicate with your voice gateway
8+
- ✅ Video
9+
- ✅ Audio
10+
- ✅ Guild + DM voice
11+
- ✅ Go Live streams
12+
- [Medooze Implementation]({{ repositories.base_url }}/{{ repositories.voice_medooze }}) - SFU written in C++ with Node.js native bindings
13+
- ✅ Video
14+
- ✅ Audio
15+
- ✅ Guild + DM voice
16+
- ✅ Go Live streams
17+
- [Mediasoup Implementation]({{ repositories.base_url }}/{{ repositories.voice_mediasoup }}) - From the Mediasoup FAQ: "mediasoup launches a set of C++ child processes (media workers) and communicates with them by means of inter-process communication"
18+
- ❌ Video
19+
- ✅ Audio
20+
- ✅ Guild + DM voice
21+
- ❌ Go Live streams (no video, only audio)
922

1023
## Configuring Voice Gateway
1124

@@ -18,7 +31,7 @@ WRTC_WS_PORT=3004
1831
You also have to configure the Voice Gateway endpoint in your database. In table `config` you can set the default region endpoint to your Voice Gateway domain. It is set to `localhost:3004` by default:
1932

2033
```
21-
"regions_available_0_endpoint": "localhost:3004"
34+
"regions_available_0_endpoint": "voice.example.com:3004"
2235
```
2336

2437
### Nginx reverse proxy for Voice Gateway
@@ -56,6 +69,28 @@ server {
5669

5770
You can install one of the provided sample implementations or you can choose to install another third-party one. Installation process will be the same regardless:
5871

72+
### Pion implementation installation
73+
74+
1. First install the package in your {{ project.name }} server:
75+
76+
```
77+
npm install {{ npm_packages.voice_pion }} --no-save
78+
```
79+
80+
2. Configure the package name in your {{ project.name }} server `.env`:
81+
82+
```
83+
WRTC_LIBRARY={{ npm_packages.voice_pion }}
84+
```
85+
86+
3. Download the Golang SFU from [Pion Repository]({{ repositories.base_url }}/{{repositories.voice_pion }})
87+
4. Make sure you have Golang installed, then start your SFU:
88+
```
89+
cd pion-sfu
90+
go run . -port <udp port> -ip <your server public ip>
91+
```
92+
The ip should be a public IP that can be accessed from the internet if this is a production instance. It will be the address that will get sent to the client during the WebRTC connection negotiation
93+
5994
### Medooze implementation installation
6095
6196
1. First install the package in your {{ project.name }} server:
@@ -78,4 +113,20 @@ You can install one of the provided sample implementations or you can choose to
78113
79114
### Mediasoup implementation installation
80115
81-
The process is exactly the same as the Medooze installation, just replace the package name in the commands with ` {{ npm_packages.voice_mediasoup }} `
116+
1. First install the package in your {{ project.name }} server:
117+
118+
```
119+
npm install {{ npm_packages.voice_mediasoup }} --no-save
120+
```
121+
122+
2. Configure the package name in your {{ project.name }} server `.env`:
123+
124+
```
125+
WRTC_LIBRARY={{ npm_packages.voice_mediasoup }}
126+
```
127+
128+
3. Configure the public IP for your WebRTC server in your {{ project.name }} server `.env`. This should be a public IP that can be accessed from the internet if this is a production instance. It will be the address that will get sent to the client during the WebRTC connection negotiation:
129+
130+
```
131+
WRTC_PUBLIC_IP=127.0.0.1
132+
```

mkdocs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ extra:
1212
server: spacebarchat/server
1313
client: spacebarchat/client
1414
voice_types: spacebarchat/spacebar-webrtc-types
15-
voice_medooze: spacebarchat/medooze-spacebar-wrtc
16-
voice_mediasoup: spacebarchat/mediasoup-spacebar-wrtc
15+
voice_pion: spacebarchat/pion-webrtc
16+
voice_medooze: spacebarchat/medooze-webrtc
17+
voice_mediasoup: spacebarchat/mediasoup-webrtc
1718
missing_routes: spacebarchat/missing-routes
1819
main: &repo_url https://github.com/spacebarchat/spacebarchat # This gets read by mkdocs without being pre-proccessed by mkdocs-macros, which is why the URL is in full.
1920
site:
2021
name: &site_name Spacebar Documentation
2122
description: &site_description "Documentation for Spacebar: a free open source selfhostable chat, voice and video discord-compatible platform"
2223
edit_uri: &edit_uri https://github.com/spacebarchat/docs/edit/master/docs/ # This gets read by mkdocs without being pre-proccessed by mkdocs-macros, which is why the URL is in full.
2324
npm_packages:
25+
voice_pion: "@spacebarchat/pion-webrtc"
2426
voice_medooze: "@spacebarchat/medooze-webrtc"
2527
voice_mediasoup: "mediasoup-spacebar-wrtc"
2628
site_name: *site_name

0 commit comments

Comments
 (0)