screen_capture
A Flutter plugin for macOS and iOS to record the screen and capture system audio, with built-in preview and trim support. This plugin currently supports screen recording on macOS and iOS only.
Features
- Screen recording on macOS and iOS
- System audio recording (not microphone)
- Native preview window after recording with trim controls
- Video trimming — cut recordings to a specific time range
- Save to Photos (iOS) / Save As dialog (macOS)
- Swift Package Manager and CocoaPods support
Installation
Add screen_capture as a dependency in your pubspec.yaml file:
dependencies:
screen_capture: ^1.0.2
Then, run:
flutter pub get
Setup
iOS
Add the following keys to ios/Runner/Info.plist:
<key>NSMicrophoneUsageDescription</key>
<string>We need access to capture audio during screen recording.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>We need access to save screen recordings to your photo library.</string>
Important:
NSPhotoLibraryAddUsageDescriptionis required — the plugin saves recordings directly to the Photos library on iOS.
macOS
Add the following keys to macos/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>We need access to record the screen.</string>
<key>NSMicrophoneUsageDescription</key>
<string>We need access to capture system audio during screen recording.</string>
Usage
Record Screen
import 'package:screen_capture/screen_capture.dart';
// Start recording
await FlutterScreenCapture.startRecording();
// Stop recording — opens native preview with save options
final path = await FlutterScreenCapture.stopRecording();
Trim Video
// Trim to keep only seconds 5 through 15
final trimmed = await FlutterScreenCapture.trimVideo(path, 5.0, 15.0);
Error Handling
try {
await FlutterScreenCapture.startRecording();
} on PlatformException catch (e) {
if (e.code == 'USER_DENIED') {
// User declined the recording permission
} else if (e.code == 'UNAVAILABLE') {
// Recording not available on this device
} else if (e.code == 'PERMISSION_DENIED') {
// Photo library access denied (iOS)
}
}
Native Preview
When stopRecording() is called, a native preview window appears automatically:
macOS:
- Video player with playback controls
- Trim controls (start/end time)
- Save As... dialog to choose save location
- Discard button to delete recording
iOS:
- Full-screen video player with playback controls
- Trim controls (start/end time)
- Save to Photos button — saves directly to the photo library
- Discard button to delete recording
Platform Support
| Platform | Minimum Version |
|---|---|
| iOS | 14.0 |
| macOS | 11.0 |
Notes
- This plugin is currently macOS and iOS only.
- The plugin captures system audio only, not microphone input.
- Video trimming uses AVFoundation and works offline.
- ReplayKit does not work on simulators — test on a real device.
- On iOS, recordings are saved to the Photos library (requires
NSPhotoLibraryAddUsageDescription). - On macOS, a native Save As dialog lets the user choose the save location.
License
MIT License. See LICENSE file for details.