ChatCallKitManagerImpl constructor

ChatCallKitManagerImpl()

Implementation

ChatCallKitManagerImpl() {
  _chat = AgoraChatManager(
    AgoraChatEventHandler(
      onCallAccept: () {
        onCallAccept();
      },
      onCallEndReason: (callId, reason) {
        onCallEndReason(callId, reason);
      },
      onError: (error) {
        onError(error);
      },
      onUserRemoved: (callId, userId, reason) {
        onUserRemoved(callId, userId, reason);
      },
      onAnswer: (callId) {
        onAnswer(callId);
      },
    ),
    stateChange: (newState, preState) {
      stateChanged(
        newState,
        preState,
      );
    },
    messageWillSendHandler: (message) {
      for (var value in handlers) {
        value.onInviteMessageWillSend.call(message);
      }
    },
  );

  _rtc = AgoraRTCManager(
    RTCEventHandler(
      onJoinChannelSuccess: () {
        onJoinChannelSuccess();
      },
      onActiveSpeaker: (uid) {
        onActiveSpeaker(uid);
      },
      onError: (err, msg) {
        onRTCError(err, msg);
      },
      onFirstRemoteVideoDecoded: (agoraUid, width, height) {
        onFirstRemoteVideoDecoded(agoraUid, width, height);
      },
      onLeaveChannel: () {
        onLeaveChannel();
      },
      onUserJoined: (agoraUid) {
        onUserJoined(agoraUid);
      },
      onRemoteVideoStateChanged: (agoraUid, state, reason) {
        onRemoteVideoStateChanged(agoraUid, state, reason);
      },
      onUserLeaved: (agoraUid) {
        onUserLeaved(agoraUid);
      },
      onUserMuteAudio: (agoraUid, muted) {
        onUserMuteAudio(agoraUid, muted);
      },
      onUserMuteVideo: (agoraUid, muted) {
        onUserMuteVideo(agoraUid, muted);
      },
    ),
  );
}