stopRecording

suspend fun stopRecording(options: StopRecordingOptions)

Stops the recording process, managing different states and actions based on current recording status.

The stopRecording function verifies if a recording session is active and not yet stopped. If conditions allow, it sends an event to stop recording on the server, updates state parameters accordingly, and shows an alert confirming the stop action. It also handles any required canvas stream stop if the recording involves video.

Parameters:

  • parameters: An instance of StopRecordingParameters providing the recording room, socket connection, and callback functions needed to manage recording states and UI updates.

Returns:

  • Unit: This function completes once the recording stop action and any related updates or alerts are handled.

Example Usage:

val stopParams = object : StopRecordingParameters {
override val roomName: String = "Room_123"
override val socket: SocketManager? = socketInstance
override val localSocket: SocketManager? = localSocketInstance
override val startReport: Boolean = true
override val endReport: Boolean = false
override val recordStarted: Boolean = true
override val recordPaused: Boolean = false
override val recordStopped: Boolean = false
override val whiteboardStarted: Boolean = true
override val whiteboardEnded: Boolean = false
override val recordingMediaOptions: String = "video"
}

// Call stopRecording to stop the recording process
stopRecording(StopRecordingOptions(parameters = stopParams))
// Expected output:
// Alert: Recording Stopped
// Show Record Buttons: false
// Capture Canvas Stream: {parameters: StopRecordingParameters, start: false}