launch Recording
Launches the recording process based on various conditions and updates the UI accordingly.
The launchRecording function manages the initiation, configuration, and visibility of a recording process, handling cases where recording is either allowed or restricted. Based on the provided LaunchRecordingOptions, it checks for permissions, shows alerts for restrictions, and updates the visibility of the recording modal.
Parameters:
options: An instance ofLaunchRecordingOptionscontaining:updateIsRecordingModalVisible: Callback to update the visibility of the recording modal.isRecordingModalVisible: Boolean indicating the current visibility of the recording modal.showAlert: Optional callback for showing alerts.stopLaunchRecord: Indicates if launching recording should be stopped.canLaunchRecord: Indicates if launching recording is permitted.recordingAudioSupport: Indicates if audio recording is supported.recordingVideoSupport: Indicates if video recording is supported.updateCanRecord: Callback to update recording permission.updateClearedToRecord: Callback to update cleared-to-record status.recordStarted: Indicates if recording has already started.recordPaused: Indicates if the recording is currently paused.localUIMode: Indicates if the UI is in local-only mode (restricts recording).
Example Usage:
// Define a showAlert function to display an alert message
val showAlert: ShowAlert = { message, type, duration ->
}
// Callbacks to update recording states
// Define options for launching recording
val options = LaunchRecordingOptions(
updateIsRecordingModalVisible = updateIsRecordingModalVisible,
isRecordingModalVisible = false,
showAlert = showAlert,
stopLaunchRecord = true,
canLaunchRecord = true,
recordingAudioSupport = true,
recordingVideoSupport = false,
updateCanRecord = updateCanRecord,
updateClearedToRecord = updateClearedToRecord,
recordStarted = false,
recordPaused = false,
localUIMode = false
)
// Launch recording process
launchRecording(options)
// Expected output:
// Recording Modal Visible: trueThis example sets up the options for launching recording, including alert handling and state updates.