I am using UIImagePickerController to choose video file from library. And user can upload the video.
Also I am using videoMaximumDuration p
Swift 4
regardless of using didFinishPickingMediaWithInfo or didFinishRecordingToOutputFileAtURL you can:
// needed only for didFinishPickingMediaWithInfo
let outputFileURL = info[UIImagePickerControllerMediaURL] as! URL
// get the asset
let asset = AVURLAsset(url: outputFileURL)
// get the time in seconds
let durationInSeconds = asset.duration.seconds