handleMethodCall method

Future handleMethodCall(
  1. MethodCall call
)

Handles method calls over the MethodChannel of this plugin. Note: Check the "federated" architecture for a new way of doing this: https://flutter.dev/go/federated-plugins

Implementation

Future<dynamic> handleMethodCall(MethodCall call) async {
  // var args = <String, dynamic>{};
  switch (call.method) {
    case 'createEngineWithProfile':
      if (call.arguments['profile'] != null &&
          call.arguments['profile']['appSign'] != null) {
        throw PlatformException(
          code: 'Unimplemented',
          details:
              'zego_rtc_engine for web doesn\'t support appSign, Please remove it',
        );
      }
      ZegoFlutterEngine.setEventHandler(
          allowInterop((String event, String data) {
        _evenController.add({'methodName': event, 'data': data});
      }));
      return createEngineWithProfile(call.arguments['profile']);
    case 'getVersion':
      return getVersion();
    case 'loginRoom':
      return loginRoom(call.arguments['roomID'], call.arguments['user'],
          call.arguments['config']);
    case 'logoutRoom':
      return logoutRoom(call.arguments['roomID']);
    case 'setVideoConfig':
      return setVideoConfig(
          call.arguments["config"], call.arguments["channel"]);
    case 'getVideoConfig':
      return getVideoConfig(call.arguments["channel"]);
    case 'enableAEC':
      return enableAEC(call.arguments["enable"]);
    case 'enableAGC':
      return enableAGC(call.arguments["enable"]);
    case 'enableANS':
      return enableANS(call.arguments["enable"]);
    case 'enableCamera':
      return enableCamera(
          call.arguments["enable"], call.arguments["channel"]);
    case 'useFrontCamera':
      return useFrontCamera(
          call.arguments["enable"], call.arguments["channel"]);
    case 'startPreview':
      return startPreview(
          call.arguments['canvas'], call.arguments["channel"]);
    case 'stopPreview':
      return stopPreview(call.arguments["channel"]);
    case 'mutePublishStreamVideo':
      return mutePublishStreamVideo(
          call.arguments["mute"], call.arguments["channel"]);
    case 'mutePublishStreamAudio':
      return mutePublishStreamAudio(
          call.arguments["mute"], call.arguments["channel"]);
    case 'muteMicrophone':
      return muteMicrophone(call.arguments["mute"]);
    case 'isMicrophoneMuted':
      return isMicrophoneMuted();
    case 'startPublishingStream':
      return startPublishingStream(call.arguments["streamID"],
          call.arguments["config"], call.arguments["channel"]);
    case 'stopPublishingStream':
      return stopPublishingStream(call.arguments["channel"]);
    case 'startPlayingStream':
      return startPlayingStream(call.arguments["streamID"],
          call.arguments["canvas"], call.arguments["config"]);
    case 'stopPlayingStream':
      return stopPlayingStream(call.arguments["streamID"]);
    case 'destroyPlatformView':
      return destroyPlatformView(call.arguments["viewID"]);
    case 'destroyEngine':
      return destroyEngine();
    case 'sendBroadcastMessage':
      return sendBroadcastMessage(
          call.arguments["roomID"], call.arguments["message"]);
    case 'sendBarrageMessage':
      return sendBarrageMessage(
          call.arguments['roomID'], call.arguments['message']);
    case 'sendCustomCommand':
      return sendCustomCommand(call.arguments['roomID'],
          call.arguments['command'], call.arguments['toUserList']);
    case 'setRoomExtraInfo':
      return setRoomExtraInfo(call.arguments['roomID'], call.arguments['key'],
          call.arguments['value']);
    case 'setSEIConfig':
      return setSEIConfig(call.arguments['config']);
    case 'sendSEI':
      return sendSEI(call.arguments['data'], call.arguments['dataLength'],
          call.arguments['channel']);
    case 'renewToken':
      return renewToken(call.arguments['roomID'], call.arguments['token']);
    case 'mutePlayStreamAudio':
      return mutePlayStreamAudio(
          call.arguments['streamID'], call.arguments['mute']);
    case 'mutePlayStreamVideo':
      return mutePlayStreamVideo(
          call.arguments['streamID'], call.arguments['mute']);
    case 'getAudioDeviceList':
      return getAudioDeviceList(call.arguments['type']);
    case 'getVideoDeviceList':
      return getVideoDeviceList();
    case 'useVideoDevice':
      return useVideoDevice(
          call.arguments['deviceID'], call.arguments['channel']);
    case 'useAudioDevice':
      return useAudioDevice(
          call.arguments['type'], call.arguments['deviceID']);
    case 'useAudioOutputDevice':
      return useAudioOutputDevice(
          call.arguments['mediaID'], call.arguments['deviceID']);
    case 'setEngineConfig':
      return setEngineConfig(call.arguments['config']);
    case 'setStreamExtraInfo':
      return setStreamExtraInfo(
          call.arguments['extraInfo'], call.arguments['channel']);
    case 'setPluginVersion':
      return;
    case 'createMediaPlayer':
      return createMediaPlayer();
    case 'mediaPlayerSetPlayerCanvas':
      return mediaPlayerSetPlayerCanvas(
          call.arguments['index'], call.arguments['canvas']);
    case 'mediaPlayerLoadResource':
      return mediaPlayerLoadResource(
          call.arguments['index'], call.arguments['path']);
    case 'mediaPlayerLoadResourceFromMediaData':
      return mediaPlayerLoadResourceFromMediaData(call.arguments['index'],
          call.arguments['mediaData'], call.arguments['startPosition']);
    case 'mediaPlayerEnableRepeat':
      return mediaPlayerEnableRepeat(
          call.arguments['index'], call.arguments['enable']);
    case 'mediaPlayerStart':
      return mediaPlayerStart(call.arguments['index']);
    case 'mediaPlayerPause':
      return mediaPlayerPause(call.arguments['index']);
    case 'mediaPlayerStop':
      return mediaPlayerStop(call.arguments['index']);
    case 'mediaPlayerResume':
      return mediaPlayerResume(call.arguments['index']);
    case 'mediaPlayerSetPlaySpeed':
      return mediaPlayerSetPlaySpeed(
          call.arguments['index'], call.arguments['speed']);
    case 'mediaPlayerMuteLocal':
      return mediaPlayerMuteLocal(
          call.arguments['index'], call.arguments['mute']);
    case 'mediaPlayerEnableAux':
      return mediaPlayerEnableAux(
          call.arguments['index'], call.arguments['enable']);
    case 'destroyMediaPlayer':
      return destroyMediaPlayer(call.arguments['index']);
    case 'mediaPlayerSetVolume':
      return mediaPlayerSetVolume(
          call.arguments['index'], call.arguments['volume']);
    case 'mediaPlayerGetTotalDuration':
      return mediaPlayerGetTotalDuration(call.arguments['index']);
    case 'setRoomScenario':
      return setRoomScenario(call.arguments['scenario']);
    case 'setRoomMode':
      return setRoomMode(call.arguments['mode']);
    case 'enableEffectsBeauty':
      return enableEffectsBeauty(call.arguments['enable']);
    case 'setEffectsBeautyParam':
      return setEffectsBeautyParam(call.arguments['param']);
    case 'startEffectsEnv':
      return;
    case 'getScreenCaptureSources':
      return;
    case 'createScreenCaptureSource':
      return createScreenCaptureSource(
          call.arguments['sourceId'], call.arguments['sourceType']);
    case 'destroyScreenCaptureSource':
      return destroyScreenCaptureSource(call.arguments['index']);
    case 'stopEffectsEnv':
      return stopEffectsEnv();
    case 'setVideoSource':
      return setVideoSource(call.arguments['source'],
          call.arguments['instanceID'], call.arguments['channel']);
    case 'setAudioSource':
      return setAudioSource(
          call.arguments['source'], call.arguments['channel']);
    case 'startCaptureScreenCaptureSource':
      return startCaptureScreen(
          call.arguments['index'], call.arguments['config']);
    case 'stopCaptureScreenCaptureSource':
      return stopCaptureScreen(call.arguments['index']);
    case 'startMixerTask':
      return startMixerTask(call.arguments);
    case 'stopMixerTask':
      return stopMixerTask(call.arguments["taskID"]);
    default:
      throw PlatformException(
        code: 'Unimplemented',
        details:
            'zego_rtc_engine for web doesn\'t implement \'${call.method}\'',
      );
  }
}