Broadcast.Root component is a React Context wrapper that provides the
broadcasting state store to all its child components. It creates a
Zustand store that handles browser events
and maintains state synchronization.
Usage
Configuration
ingestUrl
Configures the WHIP WebRTC ingest URL for the Broadcast component. You can
create the ingestUrl by passing
getIngest a string (interpreted
as a Livepeer Studio stream key or URL), Livepeer Studio stream data, or
Cloudflare stream data. Broadcast is compatible with all WHIP playback
endpoints.
aspectRatio
Specifies the aspect ratio of the content. Recommended for an optimal
broadcasting experience to minimize
Cumulative Layout Shift. The default value is 16 / 9.
Set to null to disable the aspect ratio container (see Container).
forceEnabled
Determines whether the WebRTC stream should start immediately after the user
allows access to their video/audio input. The default is false, which previews
the video first, then streams media to the server upon activation.
audio
Controls whether audio is enabled initially for the broadcast. The default is
true. Set to false to start the broadcast without requesting an audio track.
video
Controls whether video is enabled initially for the broadcast. The default is
true. Set to false to start the broadcast without requesting a video track.
hotkeys
Enables keyboard hotkeys for controlling the broadcast. Enabled by default
(true). It’s recommended to follow ARIA guidelines by keeping this enabled
unless you’re implementing custom hotkeys or there’s a conflict with existing
ones.
creatorId
Sets the creator ID for the broadcast, useful for metrics and viewership API
integration.
onError
An optional callback for handling broadcasting errors. It’s called with null
when the previous error is resolved. The callback receives the parameter:
timeout
Sets the timeout duration for playback before switching to the next source,
including SDP negotiation for WebRTC, waiting for WebRTC to play, and server
responses. The default is 10000 milliseconds.
storage
Configures the storage option for saving persistent states like volume and video
quality. The default is localStorage in the browser. Set to null to disable
storage.