Skip to main content
Quick Reference for AI Agents & Developers
// Configure video container settings
const videoSettings = new CometChatCalls.MainVideoContainerSetting();
videoSettings.setMainVideoAspectRatio(CometChatCalls.ASPECT_RATIO_CONTAIN);
videoSettings.setFullScreenButtonParams(CometChatCalls.POSITION_BOTTOM_RIGHT, true);
videoSettings.setNameLabelParams(CometChatCalls.POSITION_BOTTOM_LEFT, true, "rgba(27,27,27,0.4)");

// Apply to call settings
const callSettings = new CometChatCalls.CallSettingsBuilder()
  .setMainVideoContainerSetting(videoSettings)
  .build();
Customize the main video container’s aspect ratio, button positions, and label visibility to match your application’s design.

Prerequisites

Before customizing video views, ensure you have implemented either:

Main Video Container Settings

Use the MainVideoContainerSetting class to customize the main video view:
const videoSettings = new CometChatCalls.MainVideoContainerSetting();

// Set aspect ratio
videoSettings.setMainVideoAspectRatio(
  CometChatCalls.ASPECT_RATIO_CONTAIN
);

// Configure full screen button
videoSettings.setFullScreenButtonParams(
  CometChatCalls.POSITION_BOTTOM_RIGHT,
  true  // visible
);

// Configure name label
videoSettings.setNameLabelParams(
  CometChatCalls.POSITION_BOTTOM_LEFT,
  true,  // visible
  "rgba(27, 27, 27, 0.4)"  // background color
);

// Configure network quality label
videoSettings.setNetworkLabelParams(
  CometChatCalls.POSITION_BOTTOM_RIGHT,
  true  // visible
);

// Apply to call settings
const callSettings = new CometChatCalls.CallSettingsBuilder()
  .enableDefaultLayout(true)
  .setMainVideoContainerSetting(videoSettings)
  .setCallListener(callListener)
  .build();

Configuration Options

Aspect Ratio

Control how the video fills the container:
ValueDescription
CometChatCalls.ASPECT_RATIO_CONTAINVideo fits within container, may have letterboxing (default)
CometChatCalls.ASPECT_RATIO_COVERVideo fills container, may be cropped

Position Constants

Available positions for buttons and labels:
ConstantPosition
CometChatCalls.POSITION_TOP_LEFTTop left corner
CometChatCalls.POSITION_TOP_RIGHTTop right corner
CometChatCalls.POSITION_BOTTOM_LEFTBottom left corner
CometChatCalls.POSITION_BOTTOM_RIGHTBottom right corner

Setting Methods

MethodDescriptionDefault
setMainVideoAspectRatio(ratio)Set video aspect ratioASPECT_RATIO_CONTAIN
setFullScreenButtonParams(position, visible)Configure full screen buttonBottom right, visible
setNameLabelParams(position, visible, bgColor)Configure participant name labelBottom left, visible, rgba(27, 27, 27, 0.4)
setNetworkLabelParams(position, visible)Configure network quality indicatorBottom right, visible

Examples

Minimal UI

Hide all overlays for a clean video view:
const videoSettings = new CometChatCalls.MainVideoContainerSetting();

videoSettings.setFullScreenButtonParams(
  CometChatCalls.POSITION_BOTTOM_RIGHT,
  false  // hidden
);
videoSettings.setNameLabelParams(
  CometChatCalls.POSITION_BOTTOM_LEFT,
  false,  // hidden
  "transparent"
);
videoSettings.setNetworkLabelParams(
  CometChatCalls.POSITION_BOTTOM_RIGHT,
  false  // hidden
);

Custom Branding

Apply custom colors to match your brand:
const videoSettings = new CometChatCalls.MainVideoContainerSetting();

// Cover mode for full-bleed video
videoSettings.setMainVideoAspectRatio(
  CometChatCalls.ASPECT_RATIO_COVER
);

// Name label with brand color
videoSettings.setNameLabelParams(
  CometChatCalls.POSITION_TOP_LEFT,
  true,
  "rgba(0, 115, 255, 0.8)"  // Brand blue
);

// Move full screen to top right
videoSettings.setFullScreenButtonParams(
  CometChatCalls.POSITION_TOP_RIGHT,
  true
);

Next Steps