Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/camera/camera_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.14.0

* Adds `videoOutputPath` support to `MethodChannelCamera.startVideoRecording`.

## 2.13.1

* Changes the default implementation of `setJpegImageQuality` to a no-op so that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,18 @@ class MethodChannelCamera extends CameraPlatform {
_channel.invokeMethod<void>('prepareForVideoRecording');

@override
Future<void> startVideoRecording(int cameraId, {Duration? maxVideoDuration}) async {
return startVideoCapturing(VideoCaptureOptions(cameraId, maxDuration: maxVideoDuration));
Future<void> startVideoRecording(
int cameraId, {
Duration? maxVideoDuration,
String? videoOutputPath,
}) async {
return startVideoCapturing(
VideoCaptureOptions(
cameraId,
maxDuration: maxVideoDuration,
videoOutputPath: videoOutputPath,
),
);
}

@override
Expand All @@ -240,6 +250,7 @@ class MethodChannelCamera extends CameraPlatform {
'cameraId': options.cameraId,
'maxVideoDuration': options.maxDuration?.inMilliseconds,
'enableStream': options.streamCallback != null,
'videoOutputPath': options.videoOutputPath,
});

if (options.streamCallback != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ abstract class CameraPlatform extends PlatformInterface {
int cameraId, {
@Deprecated('This parameter is unused, and will be ignored on all platforms')
Duration? maxVideoDuration,
String? videoOutputPath,
}) {
throw UnimplementedError('startVideoRecording() is not implemented.');
}
Expand All @@ -152,7 +153,7 @@ abstract class CameraPlatform extends PlatformInterface {
/// Please see [VideoCaptureOptions] for documentation on the
/// configuration options.
Future<void> startVideoCapturing(VideoCaptureOptions options) {
return startVideoRecording(options.cameraId);
return startVideoRecording(options.cameraId, videoOutputPath: options.videoOutputPath);
}

/// Stops the video recording and returns the file where it was saved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class VideoCaptureOptions {
this.streamCallback,
this.streamOptions,
this.enablePersistentRecording = true,
this.videoOutputPath,
}) : assert(
streamOptions == null || streamCallback != null,
'Must specify streamCallback if providing streamOptions.',
Expand Down Expand Up @@ -52,6 +53,11 @@ class VideoCaptureOptions {
/// Defaults to `true`.
final bool enablePersistentRecording;

/// The path where the video should be saved.
///
/// If null, the platform will generate a temporary path.
final String? videoOutputPath;

@override
bool operator ==(Object other) =>
identical(this, other) ||
Expand All @@ -61,7 +67,8 @@ class VideoCaptureOptions {
maxDuration == other.maxDuration &&
streamCallback == other.streamCallback &&
streamOptions == other.streamOptions &&
enablePersistentRecording == other.enablePersistentRecording;
enablePersistentRecording == other.enablePersistentRecording &&
videoOutputPath == other.videoOutputPath;

@override
int get hashCode =>
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/camera/camera
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.13.1
version: 2.14.0

environment:
sdk: ^3.10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ void main() {
'cameraId': cameraId,
'maxVideoDuration': null,
'enableStream': false,
'videoOutputPath': null,
},
),
]);
Expand Down