start Recording
Starts the recording process, managing different states and actions based on recording options.
The startRecording function validates if recording can begin by checking conditions such as user confirmation, video/audio availability, and specific recording options. It then initiates either a new recording or resumes an existing one, updating related state properties and calling required functions.
This function is also responsible for displaying alerts if conditions are not met and emitting socket events to manage recording on the server. Additionally, it supports capturing a whiteboard stream if specified.
Parameters:
parameters: An instance of StartRecordingParameters that provides all the required properties and callback functions needed to manage the recording state, interactions with socket events, and any required updates.
Returns:
Boolean?: A boolean indicating whether the recording started/resumed successfully (true), was unable to start due to a condition (false), or encountered an error (null).
Example Usage:
val startParams = object : StartRecordingParameters {
override val roomName: String = "Room_123"
override val userRecordingParams: UserRecordingParams = UserRecordingParams(...)
override val socket: SocketManager? = socketInstance
override val localSocket: SocketManager? = localSocketInstance
override val confirmedToRecord: Boolean = true
override val recordingMediaOptions: String = "video"
override val videoAlreadyOn: Boolean = true
override val audioAlreadyOn: Boolean = true
override val recordStarted: Boolean = false
override val recordPaused: Boolean = false
override val recordResumed: Boolean = false
override val recordStopped: Boolean = false
override val startReport: Boolean = false
override val endReport: Boolean = true
override val canRecord: Boolean = true
override val whiteboardStarted: Boolean = true
override val whiteboardEnded: Boolean = false
// Other properties...
override fun getUpdatedAllParams(): StartRecordingParameters = this
}
val started = startRecording(StartRecordingOptions(parameters = startParams))