Participant Recording (Individual) - Android
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 startedparticipantId
: participantId of the participant to be recorder.fileFormat
: Currently onlywebm
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}
.
- Kotlin
- Java
import org.json.JSONObject
import java.io.OutputStream
import java.net.HttpURLConnection
import java.net.URL
import java.io.IOException
fun StartParticipantRecording() {
val roomId = "<YOUR ROOM ID>"
val participantId = "<PARTICIPANT ID>"
val fileFormat = "<YOUR FILE FORMAT>" // (Optional) default: webm
val bucketDirPath = "<YOUR CLOUD STORAGE BUCKET PATH>" // (Optional) test/abc
val webhookUrl = "<YOUR WEBHOOK URL>" // (Optional)
try {
val url = URL("https://api.videosdk.live/v2/recordings/participant/start")
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "POST"
conn.setRequestProperty("Authorization", "$YOUR_TOKEN")
conn.setRequestProperty("Content-Type", "application/json")
conn.doOutput = true
val json = JSONObject()
json.put("roomId", roomId)
json.put("participantId", participantId)
json.put("fileFormat", fileFormat)
json.put("bucketDirPath", bucketDirPath)
json.put("webhookUrl", webhookUrl)
conn.outputStream.use { os: OutputStream ->
val input = json.toString().toByteArray(Charsets.UTF_8)
os.write(input, 0, input.size)
}
val responseCode = conn.responseCode
if (responseCode == HttpURLConnection.HTTP_OK) {
println("Participant Recording started successfully.")
} else {
println("Failed to start participant recording.")
}
} catch (e: Exception) {
e.printStackTrace()
}
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
private void StartParticipantRecording() {
String roomId = "<YOUR ROOM ID>";
String participantId = "<PARTICIPANT ID>";
String fileFormat = "<YOUR FILE FORMAT>"; // (Optional) default: webm
String bucketDirPath = "<YOUR CLOUD STORAGE BUCKET PATH>"; // (Optional) test/abc
String webhookUrl = "<YOUR WEBHOOK URL>"; // (Optional)
try {
URL url = new URL("https://api.videosdk.live/v2/recordings/participant/start");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "$YOUR_TOKEN");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
JSONObject json = new JSONObject();
json.put("roomId", roomId);
json.put("participantId", participantId);
json.put("fileFormat", fileFormat);
json.put("bucketDirPath", bucketDirPath);
json.put("webhookUrl", webhookUrl);
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.toString().getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = conn.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
System.out.println("Participant Recording started successfully.");
} else {
System.out.println("Failed to start participant recording.");
}
} catch (Exception e) {
e.printStackTrace();
}
}
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 stoppedparticipantId
: participantId for which the recording is to be stopped.
- Kotlin
- Java
import org.json.JSONObject
import java.io.OutputStream
import java.net.HttpURLConnection
import java.net.URL
fun StopParticipantRecording() {
val roomId = "<YOUR ROOM ID>"
val participantId = "<PARTICIPANT ID>"
try {
val url = URL("https://api.videosdk.live/v2/recordings/participant/stop")
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "POST"
conn.setRequestProperty("Authorization", "$YOUR_TOKEN")
conn.setRequestProperty("Content-Type", "application/json")
conn.doOutput = true
val json = JSONObject()
json.put("roomId", roomId)
json.put("participantId", participantId)
conn.outputStream.use { os: OutputStream ->
val input = json.toString().toByteArray(Charsets.UTF_8)
os.write(input, 0, input.size)
}
val responseCode = conn.responseCode
if (responseCode == HttpURLConnection.HTTP_OK) {
println("Participant Recording stopped successfully.")
} else {
println("Failed to stop participant recording.")
}
} catch (e: Exception) {
e.printStackTrace()
}
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
private void StopParticipantRecording() {
String roomId = "<YOUR ROOM ID>";
String participantId = "<PARTICIPANT ID>";
try {
URL url = new URL("https://api.videosdk.live/v2/recordings/participant/stop");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "$YOUR_TOKEN");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
JSONObject json = new JSONObject();
json.put("roomId", roomId);
json.put("participantId", participantId);
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.toString().getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = conn.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
System.out.println("Participant Recording stopped successfully.");
} else {
System.out.println("Failed to stop participant recording.");
}
} catch (Exception e) {
e.printStackTrace();
}
}
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