我希望用户从他的库中选择一个视频,并将其限制为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中,我得到以下屏幕,我想重现:
2条答案
按热度按时间aoyhnmkz1#
在显示控制器之前,请确保将allowsEditing设置为YES。
imagePickerController.allowsEditing = YES;
njthzxwz2#
在设置视频持续时间之前,请确保将allowsEditing设置为true
按这个顺序