Skip to content
Merged
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: 3 additions & 1 deletion packages/camera/camera_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## NEXT
## 2.8.0

* Deprecates `maxVideoDuration`/`maxDuration`, as it was never implemented on
most platforms, and there is no plan to implement it in the future.
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.

## 2.7.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,13 @@ abstract class CameraPlatform extends PlatformInterface {

/// Starts a video recording.
///
/// The length of the recording can be limited by specifying the [maxVideoDuration].
/// By default no maximum duration is specified,
/// meaning the recording will continue until manually stopped.
/// With [maxVideoDuration] set the video is returned in a [VideoRecordedEvent]
/// through the [onVideoRecordedEvent] stream when the set duration is reached.
///
/// This method is deprecated in favour of [startVideoCapturing].
Future<void> startVideoRecording(int cameraId, {Duration? maxVideoDuration}) {
Future<void> startVideoRecording(
int cameraId, {
@Deprecated(
'This parameter is unused, and will be ignored on all platforms')
Duration? maxVideoDuration,
}) {
throw UnimplementedError('startVideoRecording() is not implemented.');
}

Expand All @@ -156,8 +155,7 @@ abstract class CameraPlatform extends PlatformInterface {
/// Please see [VideoCaptureOptions] for documentation on the
/// configuration options.
Future<void> startVideoCapturing(VideoCaptureOptions options) {
return startVideoRecording(options.cameraId,
maxVideoDuration: options.maxDuration);
return startVideoRecording(options.cameraId);
}

/// 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 @@ -12,6 +12,8 @@ class VideoCaptureOptions {
/// Constructs a new instance.
const VideoCaptureOptions(
this.cameraId, {
@Deprecated(
'This parameter is unused, and will be ignored on all platforms')
this.maxDuration,
this.streamCallback,
this.streamOptions,
Expand All @@ -24,8 +26,9 @@ class VideoCaptureOptions {
final int cameraId;

/// The maximum time to perform capturing for.
///
/// By default there is no maximum on the capture time.
@Deprecated('This parameter is unused, and will be ignored on all platforms')
// Platform implementations should not implement this, as it will never be
// passed from the app-facing layer.
final Duration? maxDuration;

/// An optional callback to enable streaming.
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.7.4
version: 2.8.0

environment:
sdk: ^3.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,30 +643,6 @@ void main() {
]);
});

test('Should pass maxVideoDuration when starting recording a video',
() async {
// Arrange
final MethodChannelMock channel = MethodChannelMock(
channelName: 'plugins.flutter.io/camera',
methods: <String, dynamic>{'startVideoRecording': null},
);

// Act
await camera.startVideoRecording(
cameraId,
maxVideoDuration: const Duration(seconds: 10),
);

// Assert
expect(channel.log, <Matcher>[
isMethodCall('startVideoRecording', arguments: <String, Object?>{
'cameraId': cameraId,
'maxVideoDuration': 10000,
'enableStream': false,
}),
]);
});

test('Should stop a video recording and return the file', () async {
// Arrange
final MethodChannelMock channel = MethodChannelMock(
Expand Down