Skip to content
Beam Docs
Media

Media

Calls, stages and livestreams on Beam: delivery profiles, how a session reaches Worker nodes, and what to read next.

Beam media carries live audio and video for your application's own users: calls (two to a few dozen people talking), stages (a few speakers and a large audience) and broadcasts (a livestream from OBS or an encoder to thousands of viewers). Your backend creates sessions with the Media API and signs short-lived tokens for its users; their apps connect straight to the Beam Workers that serve the session. Beam never needs your users' accounts.

Media for your application's users is separate from Room media channels, which serve members of a Room through their own Beam agent. Both use the same Workers and the same session model.


Delivery profiles

A session has exactly one delivery profile, chosen when you create it.

ProfileUseTransportLatency targetProtection
interactiveCalls, direct messages with video, screen share, voice agentsWebRTC both waysunder 250 ms one waye2ee (default) or public
stageA few speakers, many listeners, hand raisingWebRTC; listeners only receiveunder 400 mspublic (default) or e2ee
broadcastLivestreams and eventsIngest over WHIP, RTMP(S) or SRT; delivery over LL-HLS2 to 4 spublic (default) or protected
  • e2ee: frames are encrypted end to end with SFrame; Workers forward them without being able to read them. See Media Encryption.
  • public: Workers can read the media. Required for transcoding and HLS output.
  • protected: a broadcast's segments are encrypted (cbcs) for delivery through the CDN; the transcoder still sees the source, so it is not end-to-end encryption.

An interactive or stage session that is public can also be published as HLS (hls_output), for an audience larger than WebRTC should serve. A session with recording enabled keeps a recording that plays later through the same edges.


How a session reaches its viewers

  1. Your backend creates a project once and registers an Ed25519 public key on it. The private key never leaves your backend.
  2. For each call, stage or stream it creates a session with the Media API.
  3. For each user it signs a media token: who the user is, which session, and whether they may publish. See Media Tokens.
  4. The user's app hands the token to the Beam SDK, which asks the media directory for the nearest healthy Workers and connects to them directly.
  5. Core plans the session's nodes on Workers (an SFU for calls; relays near listeners for stages; ingest, transcode (on a GPU, or on a CPU for a source-only broadcast), packager, shields and edges for broadcasts) and keeps them current as the audience grows or a Worker fails. Workers verify tokens offline against the keys Core gives them and can never mint one.

Your app never chooses Workers: the directory steers each user, and the SDK fails over to the next endpoint on its own.


Start here

GoalRead
A video call in a web pageQuickstart: Call
Speakers and a large audienceQuickstart: Stage
A livestream from OBS or ffmpegQuickstart: Broadcast
A bot, transcriber or AI voice agent in a callServer-side Participants
Tokens, keys, roles and revocationMedia Tokens
What Beam, Workers and you can readMedia Encryption
Every route and fieldMedia API Reference
Media channels of a Room, for its membersRoom Media Channels
Session, participant and recording eventsMedia Webhooks

Every step of these guides also works from a terminal with beam media: create projects and sessions, mint test tokens, print ingest URLs and read a session's topology.


What you need

  • An organization API key from the Console. The Media API authenticates with it, like the rest of the BeamCore API, and media usage is charged to its organization. The key needs the media:read permission to read projects, sessions, recordings and usage, and media:write to change them and mint tokens (media:write includes reading). Both are organization-wide: Owner, Admin and Developer organization keys hold them, a key with a custom role gets them under Media in its permissions, and a key bound to a project has no Media API access.
  • The BeamCore API URL (BEAM_CORE_URL) and the media directory URL (BEAM_MEDIA_DIRECTORY_URL) of your environment. They come with access to an environment (production, or a lab for testing) and belong in your configuration: the SDKs have no default directory, and every client passes directoryUrl.
  • A backend you control, to hold the signing key and mint tokens. Never ship the signing key or the API key to a browser or mobile app.
  • For broadcasts, an encoder: OBS, ffmpeg, GStreamer or a hardware encoder that speaks WHIP, RTMP(S) or SRT.

Usage and billing

Media is metered from three sources that must agree: signed usage reports from the Workers, quality beacons from the SDKs, and Beam's own audit samples. Only verified usage is billed. Each product has these units:

ProductUnits
Interactiveparticipant-minutes, GB delivered, GB received, peak participants
Stageparticipant-minutes (speakers), listener-minutes, GB delivered, GB received, peak participants
Broadcastviewer-minutes, ingest-minutes, GB delivered, GB received, peak viewers
Transcoderendition-minutes
RecordingGB-months stored
Recording playback (VOD)GB delivered, viewer-minutes

Units are independent measures of one session. The price list of your organization decides which of them are charged: minutes, GB, both, or another unit. A unit without a price is listed in your usage and not charged. A unit your environment does not measure yet has no usage and no charge.

  • GB are 10⁹ bytes of media sent to your clients (delivered) or received from them (received), without retransmissions, padding or traffic between Beam's nodes.
  • Peak is the most participants, or viewers, connected at one instant of the hour. A stage counts speakers and listeners together.

A price may depend on what was used:

AttributeValuesUnits
Classaudio, sd (the shorter side of the video is below 720), hd (720 to 1079), fhd (1080 to 1439), uhd (1440 and above); minutes also idle, connected without mediaparticipant-, listener-, viewer- and rendition-minutes, GB delivered
Kindhuman, bot (media bots)participant- and listener-minutes
Transportwhip, whep, hls, rtmp, rtmps, srtingest-minutes, GB delivered, GB received

Rendition-minutes have no idle class. When a participant's connections overlap, the minute takes the most demanding class.

Read your verified usage with GET /v1/media/sessions/{id}/usage or GET /v1/media/usage (reference). A session whose estimate your credits cannot cover is refused with 402 insufficient_credits; a product that is not sold in an environment is refused with 402 product_not_priced.

Limits

  • Token lifetime: at most 24 hours; keep tokens to minutes or hours and mint new ones as users come back.
  • End-to-end encrypted sessions carry Opus audio and VP8 video (simulcast, or a single layer). Redundant audio (RED) is refused there; public sessions may use it. Public sessions and ingest also accept H.264, VP9, AV1 and H.265.
  • Protected broadcasts need EME ClearKey: Safari and native Apple players cannot play them yet (protected_unsupported). Public broadcasts play everywhere.
  • Media Workers need a public IP address: Workers behind home NAT do not serve media yet.

Decentralized distributed bandwidth infrastructure.

On this page