Skip to main content
Version: 2.0.x

Participant Recording (Individual) - iOS

VideoSDK offers individual participant recording, generating a single, continuous file for a participant.

This recording captures the participant's audio and video streams throughout the meeting, regardless of whether they are muted or have their camera turned off. During periods of audio muting or video disengagement, the respective tracks will be silent or display a black screen, respectively.

You can access the recorded files in the developer dashboard or opt to store them in your own cloud storage.

This guide provides an overview of the start and stop functionality for individual participant recording through APIs.

Start Individual Participant Recording

To start a participant recording, you will have to call /v2/recordings/participant/start API with following body parameters.

  • roomId: RoomId for which the participant recording is to be started
  • participantId: participantId of the participant to be recorder.
  • fileFormat: Currently only webm is supported as file format. We will add the support for other formats in future.
  • webhookUrl: The webhook URL where you would like to get the status updates of the recording. To learn more about webhooks refer here.
  • bucketDirPath: If you are using your own storage, you can provide the directory path where you want to store the recording. To configure the storage please refere this quide.

The usual recording path would look like ${sessionId}/${participantId}/${filename}.

import Foundation

func startParticipantRecording() {
let roomId = "<YOUR ROOM ID>"
let participantId = "<PARTICIPANT ID>"
let fileFormat = "<YOUR FILE FORMAT>" // (Optional) default: webm
let bucketDirPath = "<YOUR CLOUD STORAGE BUCKET PATH>" // (Optional) test/abc
let webhookUrl = "<YOUR WEBHOOK URL>" // (Optional)

let url = URL(string: "https://api.videosdk.live/v2/recordings/participant/start")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("$YOUR_TOKEN", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")

let json: [String: Any] = [
"roomId": roomId,
"participantId": participantId,
"fileFormat": fileFormat,
"bucketDirPath": bucketDirPath,
"webhookUrl": webhookUrl
]

let jsonData = try! JSONSerialization.data(withJSONObject: json)

request.httpBody = jsonData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
print("Error: \(error?.localizedDescription ?? "Unknown error")")
return
}
let responseData = try? JSONSerialization.jsonObject(with: data, options: [])
print(responseData)
}

task.resume()
}


Stop Individual Participant Recording

To stop a participant recording, you will have to call /v2/recordings/participant/stop API with following body parameters.

  • roomId: RoomId for which the participant recording is to be stopped
  • participantId: participantId for which the recording is to be stopped.
import Foundation

func stopParticipantRecording(roomId: String, participantId: String) {
let url = URL(string: "https://api.videosdk.live/v2/recordings/participant/stop")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("$YOUR_TOKEN", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")

let body: [String: Any] = ["roomId": roomId, "participantId": participantId]
request.httpBody = try? JSONSerialization.data(withJSONObject: body)

let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
print("Failed to stop participant recording")
return
}

if let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) {
print(jsonResponse)
} else {
print("Failed to parse response")
}
}

task.resume()
}

Webhook associated with Participant Recording

participant-recording-starting

  • A "Participant Recording Starting" webhook is triggered when the participant recording process for a participant is initiated.
Example
{
"webhookType": "participant-recording-starting",
"data": {
"meetingId": "jvsg-8rjn-j304",
"sessionId": "613731342f27f56e4fc4b6d0",
"participantId": "abcd",
"fileFormat": "webm",
},
}

participant-recording-started

  • Participant Recording started webhook will be received when successfully participant recording is started in meeting
Example
{
"webhookType": "participant-recording-started",
"data": {
"meetingId": "jvsg-8rjn-j304",
"sessionId": "613731342f27f56e4fc4b6d0",
"participantId": "abcd",
"fileFormat": "webm",
},
}

participant-recording-stopping

  • A "Participant Recording Stopping" webhook is triggered when the participant recording end process for a participant is initiated.
Example
{
"webhookType": "participant-recording-stopping",
"data": {
"meetingId": "jvsg-8rjn-j304",
"sessionId": "613731342f27f56e4fc4b6d0",
"participantId": "abcd",
"fileFormat": "webm",
},
}

participant-recording-stopped

  • Participant Recording stopped webhook will be received when participant recording is successfully stopped in meeting.
Example
{
"webhookType": "participant-recording-stopped",
"data": {
"meetingId": "jvsg-8rjn-j304",
"sessionId": "613731342f27f56e4fc4b6d0",
"participantId": "abcd",
"fileDetails" : [
{
"filePath" : "/encoded/videos/62d148951a1eb20029fc9b05.mp4",
"fileUrl" : "https://cdn.videosdk.live/encoded/videos/62d148951a1eb20029fc9b05.mp4",
}
]
},
}

participant-recording-failed

  • A "Participant Recording Failed" webhook is generated when the participant recording process encounters an interruption or issue during either the starting or stopping phases.
Example
{
"webhookType": "participant-recording-failed",
"data": {
"meetingId": "jvsg-8rjn-j304",
"sessionId": "613731342f27f56e4fc4b6d0",
"participantId": "abcd",
},
}

API Reference

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

Got a Question? Ask us on discord