setCustomVirtualBackgroundImages method

void setCustomVirtualBackgroundImages(
  1. List<TCICVirtualBackgroundImage> images
)

Implementation

void setCustomVirtualBackgroundImages(
  List<TCICVirtualBackgroundImage> images,
) {
  final currentIndex = _trtcStreamInfoObs.currentUnrealBGIndex.value;
  final currentKey =
      getVirtualBackgroundData().getItemByIndex(currentIndex)?.key ??
      UnrealBgData.noneKey;
  _customVirtualBackgroundImages = UnrealBgData.sanitizeCustomImages(images);
  final settingComponentConfig =
      getComponentConfig<SetttingComponentConfig>(SetttingComponentConfig) ??
      SetttingComponentConfig();
  updateComponentConfig(
    SetttingComponentConfig(
      enableAudioSetting: settingComponentConfig.enableAudioSetting,
      enableVideoSetting: settingComponentConfig.enableVideoSetting,
      enableGeneralSetting: settingComponentConfig.enableGeneralSetting,
      showMemberJoinExitInfo: settingComponentConfig.showMemberJoinExitInfo,
      showMemberHansupInfo: settingComponentConfig.showMemberHansupInfo,
      showBarrage: settingComponentConfig.showBarrage,
      showOnlyTeacherMessage: settingComponentConfig.showOnlyTeacherMessage,
      showOtherSetting: settingComponentConfig.showOtherSetting,
      virtualBackgroundImages: _customVirtualBackgroundImages,
    ),
  );
  final updatedIndex =
      getVirtualBackgroundData().findIndexByKey(currentKey) ?? 0;
  _trtcStreamInfoObs.updateCurrentUnrealBGIndex(updatedIndex);
}