initEngine method

Future<void> initEngine()

Implementation

Future<void> initEngine() async {
  if (_engineHasInit) return;
  _engineHasInit = true;
  _engine = createAgoraRtcEngine();
  await _engine.initialize(RtcEngineContext(
    appId: agoraAppId,
    audioScenario: options?.audioScenarioType,
    channelProfile: options?.channelProfile,
    areaCode: options?.areaCode,
  ));
  await _engine.setClientRole(role: ClientRoleType.clientRoleBroadcaster);
  await _engine
      .setChannelProfile(ChannelProfileType.channelProfileLiveBroadcasting);
  await _engine.setDefaultAudioRouteToSpeakerphone(true);
  _engine.unregisterEventHandler(_handler!);
  _engine.registerEventHandler(_handler!);
}