File tree Expand file tree Collapse file tree 5 files changed +37
-4
lines changed
packages/camera/camera_platform_interface Expand file tree Collapse file tree 5 files changed +37
-4
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.4
2
6
3
7
- Added the torch option to the FlashMode enum, which when implemented indicates the flash light should be turned on continuously.
Original file line number Diff line number Diff line change @@ -146,10 +146,14 @@ class MethodChannelCamera extends CameraPlatform {
146
146
_channel.invokeMethod <void >('prepareForVideoRecording' );
147
147
148
148
@override
149
- Future <void > startVideoRecording (int cameraId) async {
149
+ Future <void > startVideoRecording (int cameraId,
150
+ {Duration maxVideoDuration}) async {
150
151
await _channel.invokeMethod <void >(
151
152
'startVideoRecording' ,
152
- < String , dynamic > {'cameraId' : cameraId},
153
+ < String , dynamic > {
154
+ 'cameraId' : cameraId,
155
+ 'maxVideoDuration' : maxVideoDuration? .inMilliseconds,
156
+ },
153
157
);
154
158
}
155
159
Original file line number Diff line number Diff line change @@ -88,8 +88,11 @@ abstract class CameraPlatform extends PlatformInterface {
88
88
89
89
/// Starts a video recording.
90
90
///
91
+ /// The length of the recording can be limited by specifying the [maxVideoDuration] .
92
+ /// By default no maximum duration is specified,
93
+ /// meaning the recording will continue until manually stopped.
91
94
/// The video is returned as a [XFile] after calling [stopVideoRecording] .
92
- Future <void > startVideoRecording (int cameraId) {
95
+ Future <void > startVideoRecording (int cameraId, { Duration maxVideoDuration} ) {
93
96
throw UnimplementedError ('startVideoRecording() is not implemented.' );
94
97
}
95
98
Original file line number Diff line number Diff line change @@ -3,7 +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.0.4
6
+ version : 1.1.0
7
7
8
8
dependencies :
9
9
flutter :
Original file line number Diff line number Diff line change @@ -411,10 +411,32 @@ void main() {
411
411
expect (channel.log, < Matcher > [
412
412
isMethodCall ('startVideoRecording' , arguments: {
413
413
'cameraId' : cameraId,
414
+ 'maxVideoDuration' : null ,
414
415
}),
415
416
]);
416
417
});
417
418
419
+ test ('Should pass maxVideoDuration when starting recording a video' ,
420
+ () async {
421
+ // Arrange
422
+ MethodChannelMock channel = MethodChannelMock (
423
+ channelName: 'plugins.flutter.io/camera' ,
424
+ methods: {'startVideoRecording' : null },
425
+ );
426
+
427
+ // Act
428
+ await camera.startVideoRecording (
429
+ cameraId,
430
+ maxVideoDuration: Duration (seconds: 10 ),
431
+ );
432
+
433
+ // Assert
434
+ expect (channel.log, < Matcher > [
435
+ isMethodCall ('startVideoRecording' ,
436
+ arguments: {'cameraId' : cameraId, 'maxVideoDuration' : 10000 }),
437
+ ]);
438
+ });
439
+
418
440
test ('Should stop a video recording and return the file' , () async {
419
441
// Arrange
420
442
MethodChannelMock channel = MethodChannelMock (
You can’t perform that action at this time.
0 commit comments