setChannelProperties method

void setChannelProperties(
  1. AgoraChannelData agoraChannelData
)

Function to set all the channel properties.

Implementation

void setChannelProperties(AgoraChannelData agoraChannelData) async {
  await value.engine?.setChannelProfile(agoraChannelData.channelProfileType);
  if (agoraChannelData.channelProfileType ==
      ChannelProfileType.channelProfileLiveBroadcasting) {
    await value.engine?.setClientRole(role: agoraChannelData.clientRoleType);
  } else {
    log('You can only set channel profile in case of Live Broadcasting',
        level: Level.warning.value);
  }

  value = value.copyWith(
      isActiveSpeakerDisabled: agoraChannelData.isActiveSpeakerDisabled);

  await value.engine
      ?.muteAllRemoteVideoStreams(agoraChannelData.muteAllRemoteVideoStreams);

  await value.engine
      ?.muteAllRemoteAudioStreams(agoraChannelData.muteAllRemoteAudioStreams);

  if (agoraChannelData.setBeautyEffectOptions != null) {
    await value.engine?.setBeautyEffectOptions(
        enabled: true, options: agoraChannelData.setBeautyEffectOptions!);
  }

  await value.engine
      ?.enableDualStreamMode(enabled: agoraChannelData.enableDualStreamMode);

  if (agoraChannelData.localPublishFallbackOption != null) {
    await value.engine?.setLocalPublishFallbackOption(
        agoraChannelData.localPublishFallbackOption!);
  }

  if (agoraChannelData.remoteSubscribeFallbackOption != null) {
    await value.engine?.setRemoteSubscribeFallbackOption(
        agoraChannelData.remoteSubscribeFallbackOption!);
  }

  if (agoraChannelData.videoEncoderConfiguration != null) {
    await value.engine?.setVideoEncoderConfiguration(
        agoraChannelData.videoEncoderConfiguration!);
  }

  await value.engine?.setCameraAutoFocusFaceModeEnabled(
      agoraChannelData.setCameraAutoFocusFaceModeEnabled);

  await value.engine?.setCameraTorchOn(agoraChannelData.setCameraTorchOn);

  await value.engine?.setAudioProfile(
      profile: agoraChannelData.audioProfileType,
      scenario: agoraChannelData.audioScenarioType);
}