addCamera

View as Markdown

addCamera

Adds a camera device to the room. Using this method, a user can stream multiple video sources at the same time.

Parameters

opts
MediaTrackConstraints & { autoJoin?: boolean }

Specify the constraints for the device. In addition, you can add the autoJoin key to specify whether the device should immediately join the room or joining will be performed manually later.

Returns

Promise<RoomSessionDevice> - See RoomSessionDevice documentation for more details.

Permissions

  • room.self.additional_source

You need to specify the permissions when creating the Video Room Token on the server side.

Examples

Adding any of the camera devices to the room (duplicate streams are possible):

1await roomSession.addCamera();

Adding a specific camera:

1await roomSession.addCamera({
2 deviceId: "gOtMHwZdoA6wMlAnhbfTmeRgPAsqa7iw1OwgKYtbTLA=",
3});

Adding a high-resolution camera, joining it manually:

1const roomDev = await roomSession.addCamera({
2 autoJoin: false,
3 width: { min: 1280 },
4});
5await roomDev.join();