stopRecording method

Future<void> stopRecording()

Stops a recording that has already started.

すでに開始されている録画を停止します。

Implementation

Future<void> stopRecording() async {
  if (!recordingVideo) {
    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/$_resourceVideoId/sid/$_sidVideo/mode/mix/stop",
    headers: {
      "Content-Type": "application/json;charset=utf-8",
      "Authorization": "Basic $credential",
    },
    body: jsonEncode(
      {
        "cname": channelName,
        "uid": _recordingVideoId.toString(),
        "clientRequest": {},
      },
    ),
  );
  _sendLog(AgoraLoggerEvent.stopRecording, parameters: {
    AgoraLoggerEvent.captureSid: _sidVideo,
    AgoraLoggerEvent.captureResourceId: _resourceVideoId,
  });
  _sidCapture = null;
  _resourceVideoId = null;
  if (!_disposed) {
    notifyListeners();
  }
}