process method

最近更新时间:2022-09-20 05:17:40

void process (
    String methodName,
    List data
)

Implementation

void process(String methodName, List<dynamic> data) {
  switch (methodName) {
    case 'Warning':
      warning?.call(WarningCodeConverter.fromValue(data[0]).e);
      break;
    case 'Error':
      error?.call(ErrorCodeConverter.fromValue(data[0]).e);
      break;
    case 'ApiCallExecuted':
      apiCallExecuted?.call(
          ErrorCodeConverter.fromValue(data[0]).e, data[1], data[2]);
      break;
    case 'JoinChannelSuccess':
      joinChannelSuccess?.call(data[0], data[1], data[2]);
      break;
    case 'RejoinChannelSuccess':
      rejoinChannelSuccess
          ?.call(RtcStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'LeaveChannel':
      leaveChannel
          ?.call(RtcStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'LocalUserRegistered':
      localUserRegistered?.call(data[0], data[1]);
      break;
    case 'UserInfoUpdated':
      userInfoUpdated?.call(
          data[0], UserInfo.fromJson(Map<String, dynamic>.from(data[1])));
      break;
    case 'ClientRoleChanged':
      clientRoleChanged?.call(ClientRoleConverter.fromValue(data[0]).e,
          ClientRoleConverter.fromValue(data[1]).e);
      break;
    case 'UserJoined':
      userJoined?.call(data[0], data[1]);
      break;
    case 'UserOffline':
      userOffline?.call(
          data[0], UserOfflineReasonConverter.fromValue(data[1]).e);
      break;
    case 'ConnectionStateChanged':
      connectionStateChanged?.call(
          ConnectionStateTypeConverter.fromValue(data[0]).e,
          ConnectionChangedReasonConverter.fromValue(data[1]).e);
      break;
    case 'NetworkTypeChanged':
      networkTypeChanged?.call(NetworkTypeConverter.fromValue(data[0]).e);
      break;
    case 'ConnectionLost':
      connectionLost?.call();
      break;
    case 'TokenPrivilegeWillExpire':
      tokenPrivilegeWillExpire?.call(data[0]);
      break;
    case 'RequestToken':
      requestToken?.call();
      break;
    case 'AudioVolumeIndication':
      final list = List<Map>.from(data[0]);
      audioVolumeIndication?.call(
          List.generate(
              list.length,
                  (index) => AudioVolumeInfo.fromJson(
                      Map<String, dynamic>.from(list[index]))),
          data[1]);
      break;
    case 'ActiveSpeaker':
      activeSpeaker?.call(data[0]);
      break;
    case 'FirstLocalAudioFrame':
      firstLocalAudioFrame?.call(data[0]);
      break;
    case 'FirstLocalVideoFrame':
      firstLocalVideoFrame?.call(data[0], data[1], data[2]);
      break;
    case 'UserMuteVideo':
      userMuteVideo?.call(data[0], data[1]);
      break;
    case 'VideoSizeChanged':
      videoSizeChanged?.call(data[0], data[1], data[2], data[3]);
      break;
    case 'RemoteVideoStateChanged':
      remoteVideoStateChanged?.call(
          data[0],
          VideoRemoteStateConverter.fromValue(data[1]).e,
          VideoRemoteStateReasonConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'LocalVideoStateChanged':
      localVideoStateChanged?.call(LocalVideoStreamStateConverter(data[0]).e,
          LocalVideoStreamErrorConverter(data[1]).e);
      break;
    case 'RemoteAudioStateChanged':
      remoteAudioStateChanged?.call(
          data[0],
          AudioRemoteStateConverter.fromValue(data[1]).e,
          AudioRemoteStateReasonConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'LocalAudioStateChanged':
      localAudioStateChanged?.call(AudioLocalStateConverter(data[0]).e,
          AudioLocalErrorConverter(data[1]).e);
      break;
    case 'LocalPublishFallbackToAudioOnly':
      localPublishFallbackToAudioOnly?.call(data[0]);
      break;
    case 'RemoteSubscribeFallbackToAudioOnly':
      remoteSubscribeFallbackToAudioOnly?.call(data[0], data[1]);
      break;
    case 'AudioRouteChanged':
      audioRouteChanged
          ?.call(AudioOutputRoutingConverter.fromValue(data[0]).e);
      break;
    case 'CameraFocusAreaChanged':
      cameraFocusAreaChanged
          ?.call(Rect.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'CameraExposureAreaChanged':
      cameraExposureAreaChanged
          ?.call(Rect.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'FacePositionChanged':
      final list = List<Map>.from(data[2]);
      facePositionChanged?.call(
          data[0],
          data[1],
          List.generate(
              list.length,
                  (index) => FacePositionInfo.fromJson(
                      Map<String, dynamic>.from(list[index]))));
      break;
    case 'RtcStats':
      rtcStats?.call(RtcStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'LastmileQuality':
      lastmileQuality?.call(NetworkQualityConverter.fromValue(data[0]).e);
      break;
    case 'NetworkQuality':
      networkQuality?.call(
          data[0],
          NetworkQualityConverter.fromValue(data[1]).e,
          NetworkQualityConverter.fromValue(data[2]).e);
      break;
    case 'LastmileProbeResult':
      lastmileProbeResult?.call(
          LastmileProbeResult.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'LocalVideoStats':
      localVideoStats?.call(
          LocalVideoStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'LocalAudioStats':
      localAudioStats?.call(
          LocalAudioStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'RemoteVideoStats':
      remoteVideoStats?.call(
          RemoteVideoStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'RemoteAudioStats':
      remoteAudioStats?.call(
          RemoteAudioStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'AudioMixingFinished':
      audioMixingFinished?.call();
      break;
    case 'AudioMixingStateChanged':
      audioMixingStateChanged?.call(
        AudioMixingStateCodeConverter.fromValue(data[0]).e,
        AudioMixingErrorCodeConverter.fromValue(data[1]).e,
      );
      break;
    case 'AudioEffectFinished':
      audioEffectFinished?.call(data[0]);
      break;
    case 'RtmpStreamingStateChanged':
      rtmpStreamingStateChanged?.call(
        data[0],
        RtmpStreamingStateConverter.fromValue(data[1]).e,
        RtmpStreamingErrorCodeConverter.fromValue(data[2]).e,
      );
      break;
    case 'TranscodingUpdated':
      transcodingUpdated?.call();
      break;
    case 'StreamInjectedStatus':
      streamInjectedStatus?.call(
          data[0], data[1], InjectStreamStatusConverter.fromValue(data[2]).e);
      break;
    case 'StreamMessage':
      streamMessage?.call(data[0], data[1], data[2]);
      break;
    case 'StreamMessageError':
      streamMessageError?.call(data[0], data[1],
          ErrorCodeConverter.fromValue(data[2]).e, data[3], data[4]);
      break;
    case 'MediaEngineLoadSuccess':
      mediaEngineLoadSuccess?.call();
      break;
    case 'MediaEngineStartCallSuccess':
      mediaEngineStartCallSuccess?.call();
      break;
    case 'ChannelMediaRelayStateChanged':
      channelMediaRelayStateChanged?.call(
        ChannelMediaRelayStateConverter.fromValue(data[0]).e,
        ChannelMediaRelayErrorConverter.fromValue(data[1]).e,
      );
      break;
    case 'ChannelMediaRelayEvent':
      channelMediaRelayEvent
          ?.call(ChannelMediaRelayEventConverter.fromValue(data[0]).e);
      break;
    case 'FirstRemoteVideoFrame':
      firstRemoteVideoFrame?.call(data[0], data[1], data[2], data[3]);
      break;
    case 'FirstRemoteAudioFrame':
      firstRemoteAudioFrame?.call(data[0], data[1]);
      break;
    case 'FirstRemoteAudioDecoded':
      firstRemoteAudioDecoded?.call(data[0], data[1]);
      break;
    case 'UserMuteAudio':
      userMuteAudio?.call(data[0], data[1]);
      break;
    case 'StreamPublished':
      streamPublished?.call(data[0], ErrorCodeConverter.fromValue(data[1]).e);
      break;
    case 'StreamUnpublished':
      streamUnpublished?.call(data[0]);
      break;
    case 'RemoteAudioTransportStats':
      remoteAudioTransportStats?.call(data[0], data[1], data[2], data[3]);
      break;
    case 'RemoteVideoTransportStats':
      remoteVideoTransportStats?.call(data[0], data[1], data[2], data[3]);
      break;
    case 'UserEnableVideo':
      userEnableVideo?.call(data[0], data[1]);
      break;
    case 'UserEnableLocalVideo':
      userEnableLocalVideo?.call(data[0], data[1]);
      break;
    case 'FirstRemoteVideoDecoded':
      firstRemoteVideoDecoded?.call(data[0], data[1], data[2], data[3]);
      break;
    case 'MicrophoneEnabled':
      microphoneEnabled?.call(data[0]);
      break;
    case 'ConnectionInterrupted':
      connectionInterrupted?.call();
      break;
    case 'ConnectionBanned':
      connectionBanned?.call();
      break;
    case 'AudioQuality':
      audioQuality?.call(data[0], data[1], data[2], data[3]);
      break;
    case 'CameraReady':
      cameraReady?.call();
      break;
    case 'VideoStopped':
      videoStopped?.call();
      break;
    case 'MetadataReceived':
      metadataReceived?.call(data[0], data[1], data[2]);
      break;
      case 'FirstLocalAudioFramePublished':
      firstLocalAudioFramePublished?.call(data[0]);
      break;
    case 'FirstLocalVideoFramePublished':
      firstLocalVideoFramePublished?.call(data[0]);
      break;
    case 'AudioPublishStateChanged':
      audioPublishStateChanged?.call(
          data[0],
          StreamPublishStateConverter.fromValue(data[1]).e,
          StreamPublishStateConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'VideoPublishStateChanged':
      videoPublishStateChanged?.call(
          data[0],
          StreamPublishStateConverter.fromValue(data[1]).e,
          StreamPublishStateConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'AudioSubscribeStateChanged':
      audioSubscribeStateChanged?.call(
          data[0],
          StreamSubscribeStateConverter.fromValue(data[1]).e,
          StreamSubscribeStateConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'VideoSubscribeStateChanged':
      videoSubscribeStateChanged?.call(
          data[0],
          StreamSubscribeStateConverter.fromValue(data[1]).e,
          StreamSubscribeStateConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'RtmpStreamingEvent':
      rtmpStreamingEvent?.call(data[0], data[1]);
      break;
  }
}