Skip to main content

React Hooks

The @daydreamlive/react package provides React hooks for easy integration with React applications.

Installation

useBroadcast

Manages broadcasting state and controls.

Options

Returns

Status States

The status is a discriminated union - use status.state to determine the current state:

usePlayer

Manages playback state and controls.

Options

Returns

Status States


Complete Example

Here’s a full example with broadcasting and playback:

Next.js Server Actions Pattern

For Next.js apps, create the stream on the server and pass the WHIP URL to the client:

Live Examples

Next Steps