emitEvent method

dynamic emitEvent(
  1. TRTCCallingDelegate type,
  2. dynamic params
)

Implementation

emitEvent(TRTCCallingDelegate type, params) {
  for (var item in listeners) {
    switch (type) {
      case TRTCCallingDelegate.onInvited:
        final onInvitedPrams = InviteParams(
            callType: params["type"],
            groupID: params["groupID"],
            isFromGroup: params["isFromGroup"],
            userIDList: params["userIds"],
            sponsor: params["sponsor"]);
        item.onInvited(onInvitedPrams);
        break;
      case TRTCCallingDelegate.onCallEnd:
        item.onCallEnd();
        break;
      case TRTCCallingDelegate.onCallingCancel:
        item.onCallingCancel();
        break;
      case TRTCCallingDelegate.onUserEnter:
        final userEnterParams = OnUserEnterParams(userID: params);
        item.onUserEnter(userEnterParams);
        break;
      case TRTCCallingDelegate.onCallingTimeout:
        item.onCallingTimeout(OnCallingTimeoutParams(userIDList: List<String>.from(params)));
        break;
      case TRTCCallingDelegate.onLineBusy:
        final onLineBusyParams = OnLineBusyParams(userID: params);
        item.onLineBusy(onLineBusyParams);
        break;
      case TRTCCallingDelegate.onNoResp:
        final onNoRespParams = NoRespParams(userID: params);
        item.onNoResp(onNoRespParams);
        break;
      case TRTCCallingDelegate.onUserVideoAvailable:
        final onUserVideoAvailableParams = OnUserVideoAvailableParams(
            userID: params["userId"], available: params["available"]);
        item.onUserVideoAvailable(onUserVideoAvailableParams);
        break;
      case TRTCCallingDelegate.onUserAudioAvailable:
        final onUserAudioAvailableParams = OnUserAudioAvailableParams(
            userID: params["userId"], available: params["available"]);
        item.onUserAudioAvailable(onUserAudioAvailableParams);
        break;
      case TRTCCallingDelegate.onKickedOffline:
        item.onKickedOffline();
        break;
      case TRTCCallingDelegate.onUserLeave:
        final leaveParams = OnUserLeaveParams(
            userID: params["userId"], reason: params["reason"]);
        item.onUserLeave(leaveParams);
        break;
      case TRTCCallingDelegate.onEnterRoom:
        item.onEnterRoom(params);
        break;
      case TRTCCallingDelegate.onWarning:
        final warningPrams = OnWarningPrams(
            warningCode: params["warningCode"],
            warningMsg: params["warningMsg"],
            extraInfo: params["extraInfo"]);
        item.onWarning(warningPrams);
        break;
      case TRTCCallingDelegate.onError:
        final errprParams = OnErrorParams(
            errCode: params["errCode"],
            errMsg: params["errMsg"],
            extraInfo: params["extraInfo"]);
        item.onError(errprParams);
        break;
      case TRTCCallingDelegate.onReject:
        final rejectParams = RejectParams(userID: params);
        item.onReject(rejectParams);
        break;
      case TRTCCallingDelegate.onGroupCallInviteeListUpdate:
        final groupCallListUpdate =
            OnGroupCallInviteeListUpdateParams(userIDList: params);
        item.onGroupCallInviteeListUpdate(groupCallListUpdate);
        break;
      case TRTCCallingDelegate.onUserVoiceVolume:
        item.onUserVoiceVolume(params);
        break;
      case TRTCCallingDelegate.onAccept:
        final acceptParams = AcceptParams(userID: params);
        item.onAccept(acceptParams);
        break;
    }
  }
}