tauri-plugin-webrtc WebRTC for Tauri on Linux GitHub

CSP and frames

The shim works under a strict Content Security Policy and in same-origin iframes, with one feature lost when blob: scripts are forbidden.

Content Security Policy

The shim loads two pieces of code from blob: URLs: its AudioWorklet, and a polyfill that it wraps around workers so RTCRtpScriptTransform works. At startup it probes whether the page's CSP allows blob: scripts.

script-srcAudioEncoded transforms
Allows blob:, or no CSPAudioWorkletsRTCRtpScriptTransform available
Forbids blob:ScriptProcessorNodes with the same logicRTCRtpScriptTransform withdrawn, Worker left unwrapped

Withdrawing the class is deliberate. A library that feature-detects RTCRtpScriptTransform then takes its fallback path, instead of sending media into a worker that cannot load.

To keep encoded transforms, add blob: to script-src and worker-src, or run the call in a document whose policy allows it.

Frames

This is what Element Call needs. The Matrix client embeds it as a same-origin widget iframe with its own, laxer CSP. Group calls there keep end-to-end encryption even when the main window's CSP forbids blob:, as Tchap's does.

Navigation

When a page starts loading, every peer connection that webview created is closed. A reload or navigation never leaves a call running without a page.