Skip to content
Beam Docs
Media

Room Media Channels

Media channels of a Room: secure defaults, settings, member tokens and their client identities, guests through a token audience, recordings and the Studio routes.

A Room's media channel runs on the same media sessions as the Media API: the same Workers, directory, tokens and SDKs. The difference is who gets in. Room members join with tokens Beam mints for them from their channel permissions; nobody signs member tokens by hand.


The room project

Every Room has one media project, created by Beam with the Room's first media channel (room_id set, name Room <room_id>, a Beam-managed signing key) and deleted with the Room, which ends its sessions (session.ended with reason project_deleted). The Room's organization reads it, registers its webhooks and reads its usage through the Media API with its API keys (media:read, media:write); its keys and sessions change only through the room routes below.

A channel has at most one current session. The first member token (or a stream key on a broadcast channel) starts it, after the credit check of the Room's billing key, which pays for the channel's media like the Room's other work. A Room without a billing key cannot start one where billing is on (402 room_billing_key_missing).

Settings and secure defaults

SettingDefaultMeaning
delivery_profileinteractiveinteractive, stage or broadcast (profiles)
protection{mode: "e2ee", key_provider: "mls"}Frames are end-to-end encrypted with keys from the Room's MLS group: only members can decrypt, and only members can join
token_audiencedisabledLets non-members join with your own tokens (below)
recordingdisabled
hls_outputfalse
ladder, regions, max_participantsnoneAs in the Media API; ladder: "source" (broadcast channels only) is stored and shown as the source ladder object
protection_explicitfalseRead only: true once a settings update has set protection

So member media never becomes readable by Workers, or recorded, without a manager choosing it. protection_explicit says whether that choice was made: while it is false, the channel runs on the default above and member agents refuse to move encrypted member media to a session that is not e2ee. Switching a channel to broadcast turns hls_output on unless the same update sets it.

PUT …/media/settings takes the fields to change and the current authorization_epoch (409 authorization_epoch_mismatch when stale), and returns the settings with the next epoch. Profile and protection changes apply to the channel's next session (a session that has not started is replaced); token audience changes reach the current session at its next topology revision.

Routes

Two mirrors on BeamCore's room coordinator: the member routes /rooms/{room}/channels/{c}/media/…, authorized by the calling member's own credentials and channel permissions, and the Studio routes /studio/v1/rooms/{room}/channels/{c}/media/…, where a Beam session or an organization API key acts as the Room's owner (room:channels:read for reads and playback tokens, room:channels:write for changes).

Route (both mirrors unless noted)Body → responseChannel permission
GET …/media/settings→ settingsDiscover
PUT …/media/settings{authorization_epoch, delivery_profile?, protection?, token_audience?, recording?, hls_output?, ladder?, regions?, max_participants?} → settingsManage
POST …/media/keys, DELETE …/media/keys/{kid}{public_key, kid?, label?} → signing key; 204Manage
POST …/media/stream-keys, GET, POST …/{id}/rotate, DELETE …/{id}as the Media API stream-key routesManage
GET …/media/live→ live viewSubscribe
GET …/media/recordings→ {recordings: [...]}Subscribe
POST …/media/recordings/{recording_id}/playback-token{client?} → {token, recording_id, directory_url, expires_at_ms}Subscribe
POST /rooms/{room}/channels/{c}/media/token (member mirror only){role?, ttl_s?, name?, client?} → {token, role, session_id, project_id, directory_url, expires_at_ms}Subscribe

A channel that is not a media channel answers 404 not_found; errors use the media error body {"error", "detail"} of the Media API, with 400 unknown_field and field for a key the route does not define, and retry_after_ms plus a Retry-After header on a temporary refusal.

Member tokens

The member token route maps the member's channel permissions to the token role: Manage gives admin, Publish publish, Subscribe subscribe. role in the request may lower it, never raise it; without Subscribe the answer is 403 forbidden. ttl_s is 60 to 86,400 seconds (default 3,600).

The token's identity is member:<member_id>. A member who joins from several clients at once (a phone and a desktop, or an agent and a browser) names each one with client, a label of 1 to 32 characters [a-z0-9-]: the identity is then member:<member_id>/<client>, and each client is its own participant. A member has at most 8 client identities in a session (409 member_client_limit beyond).

Kicking or denying a member, under any of its identities, removes the member: every identity Beam minted or saw for it is denied in the session, and it gets no new token until the deny ends.

Member agents call the token route themselves. A member's browser (Studio's media viewer) never mints: it receives the token and its key document from the member's own Web Agent, which calls the route with the member's credentials.

Guests through a token audience

To let people who are not members join a channel (a public stage listener, a guest of your application), enable its token_audience: {enabled, max_role, key_ids}. The default protection (e2ee with key_provider: "mls") admits members only, so enabling a token audience on it is refused (400 invalid_request): change protection in the same settings update. Register your own public keys on the channel (POST …/media/keys), list them in key_ids, and sign tokens as described in Media Tokens with the room project's audience. Their role is capped at max_role.

For a mixed audience, set the channel to public, or to e2ee with key_provider: "customer" and your own key endpoint. A non-member token for an e2ee + mls session is refused with 403 e2ee_members_only: only members hold its keys.

Recordings

A channel with recording enabled records its sessions; list them with GET …/media/recordings and play one with a playback token from POST …/media/recordings/{recording_id}/playback-token (Beam-managed key, subscribe, one hour) through Player.load, like any recording.

Decentralized distributed bandwidth infrastructure.

On this page