-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[image_picker]Add argument maxDuration to video record #674
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,15 +56,26 @@ class ImagePicker { | |
| return path == null ? null : new File(path); | ||
| } | ||
|
|
||
| /// Returns a [File] object pointing to the video that was picked. | ||
| /// | ||
| /// The [source] argument controls where the video comes from. This can | ||
| /// be either [ImageSource.camera] or [ImageSource.gallery]. | ||
| /// | ||
| /// [maxDuration] is the maximum amount of Seconds (eg. 30.0) that is available to be recorded | ||
vagrantrobbie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// after which the video record will immediately finish and the [File] will be returned | ||
| static Future<File> pickVideo({ | ||
| @required ImageSource source, | ||
| double maxDuration | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a doc comment to pickVideo that documents this function (similarly to how it is done for pickImage) and also describe the new parameter
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also: would it be better if maxDuration is actually of type
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will add a note that the maxDuration is in Seconds.
vagrantrobbie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }) async { | ||
| assert(source != null); | ||
|
|
||
| double durationSeconds = (maxDuration==null) ? null : maxDuration.inSeconds.toDouble(); | ||
|
|
||
| final String path = await _channel.invokeMethod( | ||
| 'pickVideo', | ||
| <String, dynamic>{ | ||
| 'source': source.index, | ||
| 'maxDuration':durationSeconds | ||
| }, | ||
| ); | ||
| return path == null ? null : new File(path); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: unnecessary extra blank line.