-
-
Notifications
You must be signed in to change notification settings - Fork 247
add webrtc support #1284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
add webrtc support #1284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the few times I've reviewed your work, your code quality has been very high. very easy to read. I haven't had to chance to actually test this, but my quick glance here only gave me a few nitpick issues. thanks for all your work.
@@ -67,6 +67,7 @@ | |||
"husky": "^9.1.7", | |||
"prettier": "^3.5.3", | |||
"pretty-quick": "^4.1.1", | |||
"spacebar-webrtc-types": "github:dank074/spacebar-webrtc-types", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once this is merged, it'd be best for the org to take over this repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, can we somehow get this on npm? some deployment methods dont support using github uris in nodejs packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that it should be an org repo. Once merged repo will be transferred and it can be published under a spacebar npm account
hey, I see a lot of the config is done in .env instead of the config table, is there a reason for it being this way? |
"VOICE_SERVER_UPDATE" is not sent on join which is needed to know how to connect to the server |
the server does not notify newly joining people of the people already in voice chats, instead they only know of people they see join while they're online. And I also can't get any connection to work, it gets mostly connected, but not the rest of the way |
Config values added in this PR are related to either configuring network port or the public ip for the werbtc media server. Since the other previous port-related configs were in .env I figured it was best to keep these there as well
You mean on page load? yeah currently the previous sent state updates aren't synced with new connections. Need to add this somewhere, not sure where. The connections problems were related to the public ip config and we resolved over DM |
the issue with VOICE_SERVER_UPDATE is that it's not sent on join, it's only sent after the user joins a voice channel the the second time around. |
Hey! Nice work!
|
It does not currently. According to the medooze readme the library supports plain RTP transports though, so we could add support for the native udp protocol (which uses encrypted plain rtp packets).
Medooze only works on Linux/macos. However, since the media server package is loaded dynamically Windows users can still either start up spacebar without any webrtc support or opt to use an alternative. I'm planning to create an alternative using a mediasoup fork, just haven't gotten to it yet |
this is looking very promising, I hope the few bugs in this can be ironed out so that spacebar can get working WebRTC :3 |
This is still in draft mode since I still gotta finish and polish some stuff. It's a combination of work from previous iterations done by other people (puyo, Maddy, Chris, etc)
In order for the webrtc server to be completely compatible with a Discord client, the webrtc server:
This really limits us to which webrtc libraries we can use. The only Node ones that I found compatible were the abandoned Medooze Media Server library and an outdated fork of MediaSoup. Since these are not good long-term options, I decided to write an abstraction layer between spacebar and the webrtc server implementation that allows us to easily change the implementation without modifying spacebar source. The user can decide to use any implementation by setting an .env variable with the implementation package name and spacebar will attempt to load it. Even if none is configured, spacebar will just disable the webrtc endpoint but continue to start up normally.
This is a sample implementation that works currently: https://github.com/dank074/medooze-spacebar-wrtc
I am also planning on writing one for the Mediasoup fork. The great thing about this setup is that anyone can easily write an implementation using their favorite webrtc library and use it without any modifications to spacebar source.
This PR supports guild voice connections, DM voice connections, as well as Go Live streams