开发者

How to set the Video recording time limit in iPhone?

Is it possible to set the time limit for a video recording in the iPhone? I know the maximum limit is 10 minutes. But I want to reduce it开发者_运维技巧 to 5 minutes. If it is possible how can it be done?


You need to set the videoMaxiumDuration property on UIImagePickerController after configuring it for video recording.

The value is an NSTimeInterval which is specified in seconds, so you'll want to set it to 300 seconds if you want 5 mins of video.


You can set video Recording limitations using

[imgPickerCtrl setVideoMaximumDuration:30.0f];

Here it will limit video recording upto 30seconds also it will alert you when you select the video from library that it is beyond the limit and it will crop it automatically.


Swift 2.2:

let picker = UIImagePickerController()
let MAX_VIDEO_DURATION = 30.0 // note the .0, must be double, move this at the top of your class preferrebly
picker.videoMaximumDuration = NSTimeInterval(MAX_VIDEO_DURATION)


Swift 3.0 and Higher Version of Swift

Its Really Simple as you think.

        let imagePicker = UIImagePickerController()
        imagePicker.videoMaximumDuration = TimeInterval(30.0)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜