setDesktopVideoCaptureDevice method

Future<NEResult> setDesktopVideoCaptureDevice(
  1. String deviceId
)

Implementation

Future<NEResult> setDesktopVideoCaptureDevice(String deviceId) async {
  if (!_isDesktopRuntime) {
    return NEResult(code: -1, message: 'desktop runtime required');
  }
  if (deviceId.isEmpty) {
    return NEResult(code: -1, message: 'device id required');
  }
  CallKitUILog.i(_tag, 'setDesktopVideoCaptureDevice deviceId = $deviceId');
  if (!shouldApplyDesktopVideoCaptureDeviceImmediately(
    isDesktopRuntime: _isDesktopRuntime,
    isCameraOpen: CallState.instance.isCameraOpen,
  )) {
    _pendingDesktopVideoCaptureDeviceId = deviceId;
    return NEResult(code: 0, message: 'success');
  }
  final result = await NECallEngine.instance.setVideoCaptureDevice(deviceId);
  if (result.code == 0) {
    _pendingDesktopVideoCaptureDeviceId = null;
  }
  return NEResult(code: result.code, message: result.msg);
}