Daily supports a broad set of live streaming and recording use cases by allowing developers to define custom streaming layouts. This can be done by using either predefined properties or our programmable VCS composition engine.
To enable developers to leverage these powerful composition features in highly customized implementations, Daily supports multiple live streaming and recording instances per room.
Multi-instance live streaming should not be confused with sending the same composition stream to multiple destinations. Sending an RTMP stream to YouTube, Facebook, Amazon IVS, or other destination, is already supported by a single instance of live streaming.
Instead, multi-instance live streaming and recording can be useful for generating independent layouts for different types of users. For example, one can live stream in portrait mode for mobile participants and landscape for those on desktop.
Use cases for multi-instance live streaming and recording include:
- Generating a portrait layout for mobile viewers and a landscape layout for desktop viewers
- Presenting an enhanced layout to users with more features enabled (such as premium features or moderation views)
- Defining separate layouts for a live stream and a recording of the same event
Daily uses the same internal implementation for recording and live streaming, so they are interlinked under the hood. Daily's multi-instance live streaming and recording architecture can be visualized as follows:
Points of note
- The same RTMP stream can be streamed to multiple services (YouTube, Amazon IVS, etc)
- Recording and live streaming with the same
instanceIdare interlinked. Updating the layout of a live streaming instance will also affect the recording instance (if any) of that ID.
Working with multi-instance live streaming and recording
To enable multiple live streaming or recording instances per room, you need to first define a
max_streaming_instances_per_room property value in your Daily domain configuration. Contact us to configure this property for your domain.
max_streaming_instances_per_room property is set, you can call
startRecording() with an
instanceId parameter as follows:
To update the layout for an existing live stream, use the
updateRecording() call object instance methods:
To stop a specific live streaming or recording instance, pass its
instanceId to the
stopRecording() call object instance method:
instanceId is used to start live streaming or recording, the same ID must be provided in all subsequent calls to live streaming or recording API methods.
instanceId is not given upon starting live streaming or recording, Daily will assign a default ID (
'c3df927c-f738-4471-a2b7-066fa7e95a6b'), which is a reserved value.
All live streaming and recording events return the
instanceId associated with that event. In this way, your application can distinguish between multiple running instances.
When multiples instance are used each is counted separately. For example, if two instances are running for 60 minutes, the total resulting streaming minutes will be 120 (2 x 60).
In this guide, we covered:
- Use cases for multi-instance live streaming and recording
- An overview of Daily's live streaming and recording architecture
- How to enable and work with multi-instance live streaming and recording
Please contact us if you would like any help working with this feature.