diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index a51a5a0d491..43d3e63c42b 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -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 diff --git a/packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart b/packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart index c791d030ca2..218de02c635 100644 --- a/packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart +++ b/packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart @@ -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 startVideoRecording(int cameraId, {Duration? maxVideoDuration}) { + Future startVideoRecording( + int cameraId, { + @Deprecated( + 'This parameter is unused, and will be ignored on all platforms') + Duration? maxVideoDuration, + }) { throw UnimplementedError('startVideoRecording() is not implemented.'); } @@ -156,8 +155,7 @@ abstract class CameraPlatform extends PlatformInterface { /// Please see [VideoCaptureOptions] for documentation on the /// configuration options. Future 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. diff --git a/packages/camera/camera_platform_interface/lib/src/types/video_capture_options.dart b/packages/camera/camera_platform_interface/lib/src/types/video_capture_options.dart index 7a10b3b87c3..66ee5357d30 100644 --- a/packages/camera/camera_platform_interface/lib/src/types/video_capture_options.dart +++ b/packages/camera/camera_platform_interface/lib/src/types/video_capture_options.dart @@ -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, @@ -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. diff --git a/packages/camera/camera_platform_interface/pubspec.yaml b/packages/camera/camera_platform_interface/pubspec.yaml index 50a6a9b4af5..6691da0cb3a 100644 --- a/packages/camera/camera_platform_interface/pubspec.yaml +++ b/packages/camera/camera_platform_interface/pubspec.yaml @@ -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 diff --git a/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart b/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart index 7cf878b8c38..063633255c9 100644 --- a/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart +++ b/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart @@ -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: {'startVideoRecording': null}, - ); - - // Act - await camera.startVideoRecording( - cameraId, - maxVideoDuration: const Duration(seconds: 10), - ); - - // Assert - expect(channel.log, [ - isMethodCall('startVideoRecording', arguments: { - 'cameraId': cameraId, - 'maxVideoDuration': 10000, - 'enableStream': false, - }), - ]); - }); - test('Should stop a video recording and return the file', () async { // Arrange final MethodChannelMock channel = MethodChannelMock(