Start and Stop - Flutter
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 object. This method accepts four parameters:
-
1. webhookUrl (optional): This would be the webhook URL where you would like to listen to event 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 the 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): ARecordingConfigthat defines how the recording should be recorded. Every field is optional. -
4. transcription (optional): APostTranscriptionConfigthat lets you start post transcription for the recording.const config = RecordingConfig(// Layout Configurationlayout: ConfigLayout(type: ConfigLayoutGrid.GRID, // SPOTLIGHT | SIDEBAR, Default : GRIDpriority: ConfigLayoutPriority.SPEAKER, // PIN, Default : SPEAKERgridSize: 4, // MAX : 4),// Theme of recordingtheme: ConfigTheme.DARK, // LIGHT | DEFAULT// `mode` is used to either record video & audio both or only audio.mode: ConfigMode.VIDEO_AND_AUDIO, // audio, Default : video_and_audio// Quality of recording and is only applicable to `VIDEO_AND_AUDIO` type mode.quality: ConfigQuality.HIGH, // low (SD) | med (HD) | high (FHD), Default : med// This mode refers to orientation of recording.// landscape : Record the room in horizontally// portrait : Record the room in vertically (Best for mobile view)orientation: ConfigOrientation.LANDSCAPE, // portrait, Default : landscape);// Post Transcription ConfigurationPostTranscriptionConfig postTranscriptionConfig = PostTranscriptionConfig(enabled: true, // Enables post transcriptionsummary: SummaryConfig(enabled: true, // Enables summary generation// Guides summary generationprompt:"Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary",),);try {await room.startRecording(config: config,transcription: postTranscriptionConfig,);} on VideoSDKError catch (error) {debugPrint("startRecording failed: ${error.code} ${error.name}");}
startRecording() returns a Future that throws a VideoSDKError when the SDK refuses the call, so await it inside try/catch. On Android, a call made while the room reconnects reports 3065 on Events.error instead of throwing, so keep an Events.error handler too.
The Future completes before the recording starts, so wait for Events.recordingStateChanged to report RECORDING_STARTED.
stopRecording()
stopRecording()is used to stop the room recording which can be accessed from theRoomobject. LikestartRecording(), it returns aFuturethat can throw aVideoSDKError.
Example
import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';
class RoomScreen extends StatefulWidget {
...
}
class _RoomScreenState extends State<RoomScreen> {
late Room _room;
@override
void initState() {
super.initState();
...
}
@override
Widget build(BuildContext context) {
return Column(
children:[
ElevatedButton(
onPressed:() async {
const config = RecordingConfig(
layout: ConfigLayout(
type: ConfigLayoutGrid.GRID,
priority: ConfigLayoutPriority.SPEAKER,
gridSize: 4,
),
theme: ConfigTheme.DARK,
mode: ConfigMode.VIDEO_AND_AUDIO,
quality: ConfigQuality.HIGH,
orientation: ConfigOrientation.PORTRAIT,
);
PostTranscriptionConfig postTranscriptionConfig = PostTranscriptionConfig(
enabled: true,
summary: SummaryConfig(
enabled: true,
prompt:
"Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary",
),
);
try {
await _room.startRecording(
config: config,
transcription: postTranscriptionConfig,
);
} on VideoSDKError catch (error) {
debugPrint("startRecording failed: ${error.code} ${error.name}");
}
},
child: const Text("Start Recording"),
),
ElevatedButton(
onPressed:() async {
try {
await _room.stopRecording();
} on VideoSDKError catch (error) {
debugPrint("stopRecording failed: ${error.code} ${error.name}");
}
},
child: const Text("Stop recording"),
),
]
);
}
}
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 utilized in this guide are provided below.
Got a Question? Ask us on discord

