使用iphone PhotoLibrary时,是否限制用户选择超过60秒的视频文件? [英] While using iphone PhotoLibrary, Restrict user to select any video file more than duration of 60secs?

查看:120
本文介绍了使用iphone PhotoLibrary时,是否限制用户选择超过60秒的视频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦用户从iPhone照片库中选择视频,是否有任何方法可以检查视频文件的持续时间?并限制用户选择该视频文件是否超过60秒

Is there any method available to check video file duration as soon as user select Video from iPhone photo library ? And restrict user to select if that video file is more than 60secs

推荐答案

imagePickerController.videoMaximumDuration = 60.0f ; //将视频时长限制为60秒。

imagePickerController.videoMaximumDuration = 60.0f; // limits video length to 60 seconds.

其中imagePickerController是UIImagePickerController的对象。

where imagePickerController is object of UIImagePickerController.

使用videoMaximumDuration方法可以从两种方式限制视频的长度。就像您正在录制视频一样,将弹出一个警报,提示您录制的视频不能超过60秒;如果您从媒体库中选择任何视频文件,则如果长度超过60秒,它将首先检查视频的长度。再次会弹出警报,提示视频大于60秒,但会有两个选项,即使用或取消。如果选择使用,则它将从一开始就将视频的长度最多裁剪60秒。

Using videoMaximumDuration method you can restrict length of video from both ways. Like if you are recording video an alert will popup saying you cannot record video more than 60 sec and if you are selecting any video file from your library, first it will check the length of your video if length is more than 60 sec. Again alert will popup saying video is larger than 60 sec but there will be two options i.e. use or cancel. If you select use then it will crop the length of video upto 60sec from the beginning.

这篇关于使用iphone PhotoLibrary时,是否限制用户选择超过60秒的视频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆