Customize recording
This guide focuses on customizing room composite (browser-based) recordings.
Composite recordings in 100ms are generated by simulating a peer join: an automated browser window joins the room as bot peer (called "Beam") and records what it sees and hears. Like other peers in the room, this bot peer has an associated role. In this guide, we will create a new role called recorder
, which will be used by the bot peer to join the room. We will use this role as a way to customize the recording.
We will cover the following customizations:
- Record a specific set of roles
- Change the composition UI: useful when you want to add branding to the recorded output
- Configure the video output: useful to generate a mobile-friendly (portrait) or high resolution output
- Get an audio-only recording
Define the recorder role
Add a new role called recorder
to your template. Note that this role:
- Has no publish strategies: It does not publish audio, video or screen share
- Has valid subscribe strategies: It subscribes to other roles defined in the template
Use the recorder role
Using the role means that the bot peer joins the room with role set to recorder
. To do this, we will create a join URL for this role, and pass it as the meeting_url
in the start recording API.
This is a URL which lands into the room directly. You can use 100ms room links that look like:
https://<domain>.app.100ms.live/preview/<room_id>/<role>?skip_preview=true
Other supported query parameters:
skip_preview=true
: skips the preview page and directly joins the meeting with header and controls disabledskip_preview_headful=true
: skips the preview page and directly joins the meeting with header and controls enabledauth_token=token1234
: Use this to pass an auth token to authenticate the room join actionui_mode=activespeaker
: Render active speaker mode by defaultname=johndoe
: Use this to add a name for the peer
Configure who is recorded
The subscribe strategies for the recorder
role defines which roles are visible to the bot peer, and therefore the roles that are recorded.
For instance, in the example above, above we can limit the subscribe strategies to "host" only (instead of host and guest). That way, only the peers of the host role will be recorded.
Customize composition UI
Since composite recordings are opening a web browser, they can use full capabilities of HTML/CSS rendering to customize the recorded UI.
Instead of using 100ms links (as shown in step 2 above), we can pass the URL of any web app as meeting_url
. This URL needs to land in the room directly, without requiring any action on the user's part (for example, to click a join button). The ?skip_preview=true
flag ensures this in the 100ms web app.
Configure recorded output
We can modify the resolution of the recorded video file. Customizing this does not require adding a new role.
The start recording API accepts optional numeric values for width
and height
. If not specified, recording defaults to 1280x720 (16:9).
This can be modified to:
- Have a lower or higher video resolution (for example,
"width": 1920
and"height": 1080
) - Have a mobile-first portrait output, which has an aspect ratio of 9:16 (for example,
"width": 720
and"height": 1280
)
Get an audio-only recording
The start recording API accepts optional boolean input audio_only
which can be passed as true
to get an audio-only composite recording. This would return 1 file with combined audio for all peers in the room.