stopScreenCapture method

Future<void> stopScreenCapture()

Stops taking screenshots that have already been started.

すでに開始されているスクリーンショットの撮影を停止します。

Implementation

Future<void> stopScreenCapture() async {
  if (!capturing) {
    return;
  }
  if (_engine == null) {
    throw Exception(
      "The engine is not initialized. [connect] the engine first.",
    );
  }
  final credential = base64Encode(
    utf8.encode("${adapter.customerId}:${adapter.customerSecret}"),
  );
  await Api.post(
    "$_agoraURL/${adapter.appId}/cloud_recording/resourceid/$_resourceCaptureId/sid/$_sidCapture/mode/individual/stop",
    headers: {
      "Content-Type": "application/json;charset=utf-8",
      "Authorization": "Basic $credential",
    },
    body: jsonEncode(
      {
        "cname": channelName,
        "uid": _recordingCaptureId.toString(),
        "clientRequest": {},
      },
    ),
  );
  _sendLog(AgoraLoggerEvent.stopScreenCapture, parameters: {
    AgoraLoggerEvent.captureSid: _sidCapture,
    AgoraLoggerEvent.captureResourceId: _resourceCaptureId,
  });
  _sidCapture = null;
  _resourceCaptureId = null;
  if (!_disposed) {
    notifyListeners();
  }
}