File tree Expand file tree Collapse file tree 5 files changed +37
-3
lines changed
packages/camera/camera_platform_interface Expand file tree Collapse file tree 5 files changed +37
-3
lines changed Original file line number Diff line number Diff line change
1
+ ## 1.1.0
2
+
3
+ - Added an optional ` maxVideoDuration ` parameter to the ` startVideoRecording ` method, which allows implementations to limit the duration of a video recording.
4
+
1
5
## 1.0.5
2
6
3
7
- Added interface to support automatic exposure.
Original file line number Diff line number Diff line change @@ -147,10 +147,14 @@ class MethodChannelCamera extends CameraPlatform {
147
147
_channel.invokeMethod <void >('prepareForVideoRecording' );
148
148
149
149
@override
150
- Future <void > startVideoRecording (int cameraId) async {
150
+ Future <void > startVideoRecording (int cameraId,
151
+ {Duration maxVideoDuration}) async {
151
152
await _channel.invokeMethod <void >(
152
153
'startVideoRecording' ,
153
- < String , dynamic > {'cameraId' : cameraId},
154
+ < String , dynamic > {
155
+ 'cameraId' : cameraId,
156
+ 'maxVideoDuration' : maxVideoDuration? .inMilliseconds,
157
+ },
154
158
);
155
159
}
156
160
Original file line number Diff line number Diff line change @@ -90,8 +90,11 @@ abstract class CameraPlatform extends PlatformInterface {
90
90
91
91
/// Starts a video recording.
92
92
///
93
+ /// The length of the recording can be limited by specifying the [maxVideoDuration] .
94
+ /// By default no maximum duration is specified,
95
+ /// meaning the recording will continue until manually stopped.
93
96
/// The video is returned as a [XFile] after calling [stopVideoRecording] .
94
- Future <void > startVideoRecording (int cameraId) {
97
+ Future <void > startVideoRecording (int cameraId, { Duration maxVideoDuration} ) {
95
98
throw UnimplementedError ('startVideoRecording() is not implemented.' );
96
99
}
97
100
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ description: A common platform interface for the camera plugin.
3
3
homepage : https://github.com/flutter/plugins/tree/master/packages/camera/camera_platform_interface
4
4
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
5
5
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6
+ version : 1.1.0
6
7
version : 1.0.5
7
8
8
9
dependencies :
Original file line number Diff line number Diff line change @@ -450,10 +450,32 @@ void main() {
450
450
expect (channel.log, < Matcher > [
451
451
isMethodCall ('startVideoRecording' , arguments: {
452
452
'cameraId' : cameraId,
453
+ 'maxVideoDuration' : null ,
453
454
}),
454
455
]);
455
456
});
456
457
458
+ test ('Should pass maxVideoDuration when starting recording a video' ,
459
+ () async {
460
+ // Arrange
461
+ MethodChannelMock channel = MethodChannelMock (
462
+ channelName: 'plugins.flutter.io/camera' ,
463
+ methods: {'startVideoRecording' : null },
464
+ );
465
+
466
+ // Act
467
+ await camera.startVideoRecording (
468
+ cameraId,
469
+ maxVideoDuration: Duration (seconds: 10 ),
470
+ );
471
+
472
+ // Assert
473
+ expect (channel.log, < Matcher > [
474
+ isMethodCall ('startVideoRecording' ,
475
+ arguments: {'cameraId' : cameraId, 'maxVideoDuration' : 10000 }),
476
+ ]);
477
+ });
478
+
457
479
test ('Should stop a video recording and return the file' , () async {
458
480
// Arrange
459
481
MethodChannelMock channel = MethodChannelMock (
You can’t perform that action at this time.
0 commit comments