matrix-org / matrix-rust-sdk

Matrix Client-Server SDK for Rust
Apache License 2.0
1.19k stars 238 forks source link

VoIP call support via webrtc-rs #3295

Open DemiMarie opened 5 months ago

DemiMarie commented 5 months ago

Implementing VoIP calls in downstream projects is not simple. Web clients can and must use the native browser implementation, but desktop and mobile clients don’t have that option, so e.g. Fractal doesn’t support calls at all. matrix-rust-sdk could provide helpers that make it easy to support calls in desktop and mobile clients.

Hywan commented 5 months ago

Hello @DemiMarie and thank you for your suggestion. What kind of helpers do you imagine? There is this matrix_sdk::widget API that is used to set up VoIP (at least it's used by Element X for Element Call). Do you expect more (maybe a better documentation… 🙄)?

DemiMarie commented 5 months ago

@Hywan I’m imagining an implementation of one-to-one calls that doesn’t rely on an embedded browser engine. Secure end-to-end encryption requires that all servers be treated as untrusted, which means that relying on a webview that loads JavaScript from Element’s servers isn’t an option.

DemiMarie commented 4 months ago

@Hywan To be specific, I would like matrix-rust-sdk to integrate with https://github.com/webrtc-rs/webrtc, which provides a memory-safe WebRTC implementation that doesn’t rely on a web browser.

Hywan commented 4 months ago

@manuroe what do you think about this suggestion?

DemiMarie commented 4 months ago

To elaborate: Windows, macOS, iOS, and Android have a system-provided webview, but desktop Linux and embedded systems do not. Embedded devices, obviously, have no webview unless they bring their own. Desktop Linux has WebKitGTK+ and Qt WebEngine, but these are tied to specific UI frameworks, and not every desktop Linux program uses GTK or Qt. Qt WebEngine also has a rather long patch gap compared to upstream Chromium.

WebRTC is also a large C++ library that has had remote code execution vulnerabilities in the past. Signal’s mobile apps disable some especially risky functionality, but I’m not sure if this can be done in a web environment.