Skip to main content
Version: Next

Record Participant - Flutter

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 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
final String roomId = "<YOUR ROOM ID>";
final String participantId = "<PARTICIPANT ID>";
final String fileFormat = "<YOUR FILE FORMAT>"; // (Optional) default: webm
final String bucketDirPath = "<YOUR CLOUD STORAGE BUCKET PATH>"; // (Optional) test/abc
final String webhookUrl = "<YOUR WEBHOOK URL>"; // (Optional)

Future<void> startParticipantRecording() async {
final url = Uri.parse("https://api.videosdk.live/v2/recordings/participant/start");
final headers = {
"Authorization": "$YOUR_TOKEN",
"Content-Type": "application/json",
};
final body = jsonEncode({
"roomId": roomId,
"participantId": participantId,
"fileFormat": fileFormat,
"bucketDirPath": bucketDirPath,
"webhookUrl": webhookUrl,
});

final response = await http.post(url, headers: headers, body: body);
final data = json.decode(response.body);
print(data);
}

@override
Widget build(BuildContext context) {
startParticipantRecording();
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Participant Recording Started'),
),
body: Center(
child: Text('Participant Recording in Progress...'),
),
),
);
}
}

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 'dart:convert';
import 'package:http/http.dart' as http;

Future<void> stopParticipantRecording(String roomId, String participantId) async {
final url = Uri.parse('https://api.videosdk.live/v2/recordings/participant/stop');
final headers = {
'Authorization': '$YOUR_TOKEN',
'Content-Type': 'application/json',
};
final body = json.encode({
'roomId': roomId,
'participantId': participantId,
});

final response = await http.post(url, headers: headers, body: body);

if (response.statusCode == 200) {
print('Participant Recording stopped successfully');
} else {
print('Failed to stop participant recording');
}
}

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