Skip to main content
Version: 4.x.x

Record Room - iOS

Room recording allows participants to record video & audio in the room. The recording files are available in developer dashboard. Any participant can start / stop recording any time in the room.

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

  1. Start Recording - By using startRecording() function, a participant can start room recording.
  2. Stop Recording - By using stopRecording() function, a participant can stop room recording.

Both methods are async throws. Call them with try await inside a Task.

Start And Stop Recording​

/// webhook url
private let recordingWebhookUrl = "<webhook-url-here>"

/// aws directory path
private let recordAwsDirPath = "<aws-dir-path>"

/// custom configuration for recording
private let recordConfig = RecordingConfig(
layout: ConfigLayout(
type: .GRID,
priority: .PIN,
gridSize: 4
), theme: .DARK,
mode: .VIDEO_AND_AUDIO,
quality: .MED,
orientation: .landscape
)

/// keep track of recording
private var recordingStarted = false

@IBAction func recordButtonTapped(_ sender: Any) {
Task {
do {
if !recordingStarted {
// start recording
try await self.room?.startRecording(webhookUrl: recordingWebhookUrl,
awsDirPath: recordAwsDirPath,
config: recordConfig)
} else {
// stop recording
try await self.room?.stopRecording()
}
} catch {
print("Recording error: \(error)")
}
}
}

Events​

  1. onRecordingStarted - Whenever any participant starts room recording, then onRecordingStarted event will trigger.

  2. onRecordingStopped - Whenever any participant stops room recording, then onRecordingStopped event will trigger.

/// Called after recording starts
func onRecordingStarted() {
recordingStarted = true

// show indication that room recording is started.
}

/// Called after recording stops
func onRecordingStopped() {
recordingStarted = false

// hide room recording indication.
}

API Reference​

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

Got a Question? Ask us on discord