Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[image_picker]Add argument maxDuration to video record #674

Closed

Conversation

vagrantrobbie
Copy link

Can pass a double of seconds to maxDuration to limit the duration of the video record

Can pass a double of seconds to maxDuration to limit the duration of the video record
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@vagrantrobbie
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

}) async {
assert(source != null);

final String path = await _channel.invokeMethod(
'pickVideo',
<String, dynamic>{
'source': source.index,
'maxDuration':maxDuration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space after :

@@ -73,16 +73,25 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
break;
}
} else if ([@"pickVideo" isEqualToString:call.method]) {

Copy link
Member

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.

_imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
_imagePickerController.delegate = self;
_imagePickerController.mediaTypes = @[
(NSString *)kUTTypeMovie, (NSString *)kUTTypeAVIMovie, (NSString *)kUTTypeVideo,
(NSString *)kUTTypeMPEG4
];
_imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;

Copy link
Member

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.

@@ -58,13 +58,15 @@ class ImagePicker {

static Future<File> pickVideo({
@required ImageSource source,
double maxDuration
Copy link
Member

Choose a reason for hiding this comment

The 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 maxDuration in there?

@@ -58,13 +58,15 @@ class ImagePicker {

static Future<File> pickVideo({
@required ImageSource source,
double maxDuration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: would it be better if maxDuration is actually of type Duration? Currently it is unclear what the unit for durations is. Seconds? Minutes? Hours?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add a note that the maxDuration is in Seconds.

@@ -237,6 +237,14 @@ private void launchTakeVideoWithCameraIntent() {
intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
grantUriPermissions(intent, videoUri);

// Set a maximum duration for the video record
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the comment is not really providing any value. Maybe remove?


_result = result;
_arguments = call.arguments;

// Set a maximum duration for the video record
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@goderbauer
Copy link
Member

You'll also have to address the formatting issues uncovered by our CI: https://cirrus-ci.com/task/5089761320501248

Remove extra white space and document ImagePicker.pickVideo method channel
@vagrantrobbie
Copy link
Author

Now uses Duration

@Hixie
Copy link
Contributor

Hixie commented Oct 25, 2018

@vagrantrobbie looks like something bad happened with the dependencies here, not sure why. Can you try updating to tip of tree and resubmitting? Maybe try running the tests locally, see if they work there.

@cyanglaz cyanglaz changed the title Add argument maxDuration to video record [image_picker]Add argument maxDuration to video record Feb 22, 2019
@cyanglaz cyanglaz self-assigned this Apr 19, 2019
@cyanglaz
Copy link
Contributor

@vagrantrobbie Could you try rebase and see if the CI issue is resolved?

@cyanglaz
Copy link
Contributor

cyanglaz commented Jul 8, 2019

@vagrantrobbie I'm going to relentlessly close this PR since it has been inactive for a while. I encourage you to reopen it when you are ready to work on it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants