Media Encryption
Who can read your media: end-to-end encrypted calls with SFrame, public sessions, protected broadcasts, key providers and what Workers see.
Every media connection is encrypted on the wire (DTLS-SRTP for WebRTC, TLS for
HLS and ingest). What differs between sessions is whether the Workers that
carry the media can read it. A session's protection decides:
| Mode | Profiles | Workers can read the media | Allows |
|---|---|---|---|
e2ee | interactive (default), stage | No: frames are encrypted by the sender and decrypted by each receiver | WebRTC delivery only |
public | stage (default), interactive, broadcast (default) | Yes | HLS output, transcoding, recording |
protected | broadcast | The transcoder and packager, yes; shields, edges and caches see ciphertext only | Delivery through the CDN to players with EME ClearKey |
protected is content protection for distribution, not end-to-end encryption.
End-to-end encryption (SFrame)
In an e2ee session every audio and video frame is encrypted with SFrame
(RFC 9605, cipher suite AES_128_GCM_SHA256_128), before it is packetized,
in the browser's WebRTC Encoded Transform, in the mobile SDKs' frame encryptor,
or in a server participant. The SFU forwards the encrypted payload unchanged.
What stays visible to Workers, by design, so that they can route media without reading it:
- RTP headers and the header extensions used for routing and quality: simulcast layer ids, the dependency descriptor, audio level (for active speaker detection), transport-wide congestion control;
- the first 10 bytes of a VP8 key frame and 3 bytes of other VP8 frames (frame type and dimensions), authenticated by SFrame so they cannot be altered;
- timing and sizes of frames, and who is connected.
End-to-end encrypted sessions carry Opus audio and VP8 video (simulcast,
up to three layers). Other codecs are refused (415 codec_not_allowed).
Keys
Each sender derives a key per frame from a base key per key epoch and its key id. Receivers keep the current and the previous epoch, and a replay window of 1,024 frames per sender. That receive state belongs to the session, not to a connection: the SDK keeps it across reconnects, so a frame replayed after a reconnect is still refused. Senders switch to a new epoch one second after receiving it, so receivers always have it first.
Who hands out base keys is the session's key provider:
key_provider | Keys come from | Use |
|---|---|---|
customer | Your backend, through the key endpoint you host | Applications with their own users: the call quickstart shows one |
mls | The Room's MLS group | Room media channels (their default): only Room members can join (403 e2ee_members_only for any other token), and Beam's auditors never join them |
With customer, Beam never sees a key: your backend derives base keys from a
secret only it holds, gives each caller a unique sender pair, and increments the
epoch when membership must change. Removing a user takes three things:
- Kick it through the Media API, so Workers close its connections and deny its identity until its token expires.
- Refuse key documents to that identity in your key endpoint until its last token has expired. The key endpoint checks tokens itself, and a removed user's token can still be valid: without this deny list it would fetch the next epoch's key like everyone else.
- Increment the epoch. Every remaining participant moves to the new key within
refresh_after_ms(at once onparticipant.left), and the removed user cannot decrypt what follows.
Persist the epoch and the sender counter of each session (your database): a backend that restarts with an in-memory counter could hand a sender pair out again under the same key, which SFrame forbids.
The key document every key provider returns:
{
"schema_version": "beam-media-keys/v1",
"session_id": "msn_...",
"cipher_suite": 4,
"sender_index": 0,
"sender_slot": 7,
"current_epoch": 9,
"keys": [{ "epoch": 9, "base_key": "8f3c1a5e9b2d4f6071829304a5b6c7d8" }, { "epoch": 8, "base_key": "00112233445566778899aabbccddeeff" }],
"refresh_after_ms": 30000
}sender_index and sender_slot (0 to 65535 each) must be unique per sender in
a session: derive them from a counter (sender_index = c >> 16,
sender_slot = c & 0xffff), never from a hash of the identity. keys holds one
to four epochs including current_epoch; base_key is 16 bytes in hex. The
recommended derivation, used by the server SDKs:
base_key(epoch) = HKDF-SHA256(salt = "beam-sframe-v1 customer key",
ikm = your 32-byte master secret,
info = UTF-8(session_id) || 0x00 || uint64 big-endian(epoch),
L = 16)Public broadcasts and integrity
A public broadcast is delivered in clear through Worker edges. Integrity does not depend on trusting the edges: the packager signs a manifest of every segment's SHA-256 with a key bound to its lease, the directory gives players that key, and the SDK player checks every segment, part and init segment before playing it. Transcoders and packagers run only on Workers with a strong audit history, and Beam's auditors compare sampled frames. A recording or broadcast packaged again by a replacement Worker carries a new, versioned init segment named in the signed manifest, so an edge never serves a stale one.
Tokens and access
Whatever the mode, a Worker serves only connections whose media token verifies against the project's keys, and closes connections whose nonce or identity your backend revokes. Workers verify tokens but cannot mint them.
Server-side Participants
Bots, recorders, transcribers and AI voice agents join calls and stages from Go or Python with the same tokens as browsers.
Media API Reference
Every Media API route: projects, signing keys, tokens, sessions, topology, participants, stream keys, recordings, usage, the directory join and QoE beacons.