enableCam method
Enables the WebCam device for the local participant.
- When the WebCam is successfully enabled, a Events.streamEnabled event is emitted with a Stream object in the event handler, inside the corresponding Participant object.
Parameters
customVideoTrack(optional): A custom video track to be used instead of the default WebCam track. This is useful when you want to provide a pre-processed video source (for example, a virtual WebCam, screen capture, or a WebCam track with applied effects).
Events associated with enableCam()
- Events.streamEnabled with the enabled video Stream
Example
// Enable WebCam with default device
await room.enableCam();
// Enable WebCam with a custom video track
final customTrack = await CustomTrack.createCameraTrack();
await room.enableCam(customTrack);
room.on(Events.streamEnabled, (event) {
print('Camera stream enabled: ${event.stream.id}');
});
Implementation
Future<void> enableCam([CustomTrack? customVideoTrack]) =>
_enableCamImpl(customTrack: customVideoTrack);