I want to select video from gallery but user can only choose video upto 30 seconds from the app.
so how to achieve video trimming for certain amount of time?
By using AVFoundation I have done till selecting the video but i don't know how to trim the video?
Is there any third party library or any other way?
Try this code to select/trim video 30 second from the gallery.
func selecteVideoFromGallery() {
let controller = UIImagePickerController()
controller.sourceType = .photoLibrary
controller.videoMaximumDuration = 30.00
controller.allowsEditing = true
controller.mediaTypes = [kUTTypeMovie as String]
controller.delegate = self
controller.isEditing = true
present(controller, animated: true, completion: nil)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.