reInitiateRecording function

Future<void> reInitiateRecording(
  1. ReInitiateRecordingOptions options
)

Re-initiates the recording for a specified room and member.

This function sends a request to the server to start recording for a specific room and member. If the adminRestrictSetting option is set to false, the recording re-initiation request will be sent through the socket connection. Upon completion, the server responds with success or failure, which can be handled within the function or in the calling context.

Parameters:

  • options - An instance of ReInitiateRecordingOptions, containing:
    • roomName: Name of the room to start recording.
    • member: Name of the member initiating the recording.
    • socket: The socket instance for server communication.
    • adminRestrictSetting: Boolean flag that, when true, prevents the recording from being re-initiated.

Example usage:

final options = ReInitiateRecordingOptions(
  roomName: 'meetingRoom123',
  member: 'adminUser',
  socket: socketInstance,
  adminRestrictSetting: false,
);

reInitiateRecording(options).then((_) {
  print("Re-initiate recording attempt completed.");
}).catchError((error) {
  print("Failed to re-initiate recording: $error");
});

If the re-initiation attempt is successful, further success handling logic can be implemented as needed. If the attempt fails, handle the failure within the function or in the calling context.

Returns:

  • A Future<void> that completes when the request to re-initiate recording is sent.

Implementation

Future<void> reInitiateRecording(ReInitiateRecordingOptions options) async {
  // Check if admin restrictions allow recording re-initiation
  if (!options.adminRestrictSetting) {
    options.socket!.emitWithAck(
      'startRecordIng',
      {'roomName': options.roomName, 'member': options.member},
      ack: (dynamic data) {
        bool success = data['success'] ?? false;
        if (success) {
          // Handle successful re-initiation, if needed
        } else {
          // Handle failed re-initiation, if needed
        }
      },
    );
  }
}