startCloudRecording method

Future<void> startCloudRecording({
  1. required AgoraConnectionData connectionData,
})

Implementation

Future<void> startCloudRecording(
    {required AgoraConnectionData connectionData}) async {
  final response = await http.post(
    Uri.parse(
        '${connectionData.cloudRecordingUrl}/start-recording/${connectionData.channelName}'),
  );

  if (response.statusCode == HttpStatus.ok) {
    value = value.copyWith(
      sid: jsonDecode(response.body)['sid'],
      resourceId: jsonDecode(response.body)['resource_id'],
    );
    log('Recording Started with SID ${value.sid} and RESOURCE ID: ${value.resourceId}',
        level: Level.warning.value);
  } else {
    log('Couldn\'t start the recording : ${response.statusCode}',
        level: Level.error.value);
  }
}