useLiveStreaming
useLiveStreaming(params?) : Object
Returns information about a live stream, along with helper functions that wrap daily-js live streaming-related methods.
useLiveStreaming can also be used to set up optional callbacks for live streaming events.
When multiple live streams are running concurrently (see multi-instance live streaming), you can pass an instanceId to get per-instance state. Without instanceId, the hook returns aggregate state across all instances. For a list of all active instances, see useLiveStreamingInstances.
Params (optional)
| Parameter | Required | Type | Description |
|---|---|---|---|
instanceId | string | A valid UUID. When provided, returns state for a specific live streaming instance and filters event callbacks to only fire for that instance. See multi-instance live streaming. | |
onLiveStreamingError | Function | Callback for the live-streaming-error event | |
onLiveStreamingStarted | Function | Callback for the live-streaming-started event | |
onLiveStreamingStopped | Function | Callback for the live-streaming-stopped event | |
onLiveStreamingUpdated | Function | Callback for the live-streaming-updated event | |
onLiveStreamingWarning | Function | Callback for the nonfatal-error event with type 'live-streaming-warning' |
Return type
An object with the following properties:
Without instanceId (aggregate state)
When called without instanceId, the hook returns aggregate state across all live streaming instances. This works well for single-instance use cases — the scalar fields (errorMsg, layout) reflect the only active instance. With multiple concurrent instances, these fields reflect the first active instance; use useLiveStreaming({ instanceId }) for unambiguous per-instance access.
| Name | Type | Description |
|---|---|---|
errorMsg | string | Error message from the first errored instance. With multiple instances, use useLiveStreaming({ instanceId }) for per-instance error state. |
isLiveStreaming | boolean | true if any live streaming instance is active |
layout | Object | Layout of the first active instance. With multiple instances, use useLiveStreaming({ instanceId }) for per-instance layout. |
startLiveStreaming | Function | See startLiveStreaming() |
stopLiveStreaming | Function | See stopLiveStreaming() |
updateLiveStreaming | Function | See updateLiveStreaming() |
With instanceId (per-instance state)
When called with instanceId, the hook returns state for that specific live streaming instance only.
| Name | Type | Description |
|---|---|---|
errorMsg | string | Error message for this instance, if any |
instanceId | string | The instance ID |
isLiveStreaming | boolean | Whether this instance is currently live streaming |
layout | Object | The live streaming layout for this instance |
startLiveStreaming | Function | See startLiveStreaming() |
stopLiveStreaming | Function | See stopLiveStreaming() |
updateLiveStreaming | Function | See updateLiveStreaming() |
For more on live streaming with Daily, reference our guide.