我希望用户从他的库中选择一个视频并将其限制为 45 秒(如 WhatsApp - 您可以编辑视频,并且将发送的视频不超过 45 秒。
但是如果我使用下面的代码,它会选择一个视频而不考虑持续时间,我不能修剪它(用视频测试,长度为 1 分钟)
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.videoQuality = UIImagePickerControllerQualityTypeLow;
imagePickerController.videoMaximumDuration = 45.0f; //?
imagePickerController.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[[self parentViewController] presentModalViewController:imagePickerController animated:YES];
[imagePickerController release];
在 WhatsApp 中,我得到以下屏幕,我想重现该屏幕: