Closed kozabrada123 closed 4 months ago
Welp these new build errors on wasm are just because I have no compatibility yet
Update: I am now be 100% sure I am properly receiving and decrypting the audio
I've tried to make a very simple app that echoes voice data back, but the sent data never arrives to the original client
Maybe I messed something up in the sending code or Discord might just have a very sophisticated algorithm :tm: that just ignores packets if they have duplicate data
Github is drunk, idk why it wanted to merge w/o any new commits on dev
Update on this, I haven't had the time to work on this for a while, I'll see when I can restart this the next thing I will probably try is encoding and decoding files with a crate
If I can get decoding and encoding working in an example app, I can see whether the ddc client plays my encoded and serialized audio. if not, then I've messed something up / something is still missing.
If it does play, I can ship the app's code as an example and get to merging this!
The transport layer works perfectly, I just can't decode ddc's opus for some reason :/
(opening this into a pr to track changes, progress, todos and merge conflicts)
This pr (when complete) aims to add voice channel and call support to Chorus via Discord's UDP api.
Current todo:
Features:
Docs:
Compatibility:
UDP WASM compatibility- the browser cannot do udp.Code quality:
UDP vs Webrtc
User accounts sometimes use an undocumented Webrtc api for voice and video, while bots use the documented UDP api. I've decided to implement the UDP api for now, since Webrtc is much more complex and less documented. We may want to look into Webrtc aswell in the future.
Architecture and public API
My current plan is to have four parts of the impl: the Voice Gateway, voice UDP, Voice Data and Voice Handler
The user can then interact with the Voice Gateway to issue gateway commands and receive voice context. The voice UDP handler would expose a slightly higher level api, with listener events for decrypted and deserialized audio as well as a method which serializes, encrypts and sends audio.