enableCam method

Future<void> enableCam([
  1. CustomTrack? customVideoTrack
])

Enables the WebCam device for the local participant.

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()

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);