Skip to main content
Version: 4.x.x

Start and Stop - iOS

This guide will provide an overview of how to implement start and stop Room Recording.

startRecording()​

startRecording() can be used to start a recording of the room which can be accessed from the Room class. This method accepts four parameters:

  • 1. webhookUrl (optional): This is the webhook URL where you would like to listen to events happening for the recording, like starting and stopping of recording. It will be triggered when the recording is completed and stored into server. Read more about webhooks here.

  • 2. awsDirPath (optional): This parameter accepts the path for your S3 bucket where you want to store recordings to. To allow us to store recording in your S3 bucket, you will need to fill this form by providing the required values. (VideoSDK Cloud (AWS S3, Azure Blob or GCP ) Integration)

  • 3. config (optional): A RecordingConfig that defines how the room should be recorded: its layout, theme, mode, quality and orientation.

  • 4. transcription (optional): A PostTranscriptionConfig that enables post transcription for the recording with the given config.

note

All four parameters default to nil, so you can leave out the ones you don't need. You don't have to pass nil in their place. If you leave out awsDirPath, recordings are stored on VideoSDK's storage.

startRecording() is async throws, so call it with try await inside a Task after you join the room. If the request fails, for example because you have not joined yet, it throws a VideoSDKError. It returns before the recording starts, so wait for onRecordingStateChanged to report RECORDING_STARTED.

class RoomViewController: UIViewController {

var room: Room?

// button to start recording the room
@IBAction func recordRoomButtonTapped(_ sender: Any) {

let transcription: PostTranscriptionConfig = PostTranscriptionConfig(
enabled: true,
summary: SummaryConfig(
enabled: true,
prompt: "Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary"
)
)

Task {
do {
try await self.room?.startRecording(
webhookUrl: "<your webhook-url>",
awsDirPath: "<your awsDirPath>",
config: RecordingConfig(
layout: ConfigLayout(type: .GRID, priority: .SPEAKER, gridSize: 4),
theme: .DARK,
mode: .VIDEO_AND_AUDIO,
quality: .HIGH,
orientation: .portrait
),
transcription: transcription
)
} catch {
print("Failed to start recording: \(error)")
}
}
}
}

stopRecording()​

  • stopRecording() is used to stop the room recording which can be accessed from the Room class. It is also async throws.

Example​

extension RoomViewController {

// button to stop recording the room
@IBAction func stopRecordingButtonTapped(_ sender: Any) {
Task {
do {
try await self.room?.stopRecording()
} catch {
print("Failed to stop recording: \(error)")
}
}
}
}
important

To initiate automatic recording at the beginning of a session, simply provide the autoStartConfig feature recording during room creation. For more information on configuring the autoStartConfig, please refer to the provided documentation here.

API Reference​

The API references for all the methods utilised in this guide are provided below.

Got a Question? Ask us on discord