ios - videoMaximumDuration 不限制持续时间

标签 ios objective-c video uiimagepickercontroller

我希望用户从他的库中选择一个视频并将其限制在 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 中,我得到以下屏幕,我想复制它: enter image description here

最佳答案

确保在显示 Controller 之前将 allowsEditing 设置为 YES。

imagePickerController.allowsEditing = YES;

关于ios - videoMaximumDuration 不限制持续时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10321254/

相关文章:

iphone - 检查 tabBar 在 iOS 应用程序上是否可见

ios - 如何根据设备大小在 Marco.h 中定义字体大小?

objective-c - 邮件发送失败

objective-c - 在 Objective-C 中创建一个整数属性数组

ios - 方法确实在父 View Controller 中调用,但方法内部的逻辑从不执行任何操作

swift - 如何重新缩放以纵向模式拍摄的视频以适合 UIView?

html - Reveal.js 中如何循环数据背景视频?

ios - iOS实现长时间后台任务的方法

ios - 初始化具有多个依赖项的 RAC ReactiveSwift 属性?

macos - 视频样本帧