title: iPhone :How to get duration of video selected from library?
body: <p>I am using <code>UIImagePickerController</code> to choose video file from library. And user can upload the video.</p>
  
  <p>Also I am using <code>videoMaximumDuration</code> property while user wants to capture video and upload it.     </p>
  
  <p>I want to know that How can I get the duration of selected video file ? so that I can restrict the user to upload video that has duration more then 20 seconds.  </p>
  
  <p>I am able to get some basic info about selected video by this code :</p>
  
  <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
  {
      selectedVideoUrl = [info objectForKey:UIImagePickerControllerMediaURL];
      NSError *error;
      NSDictionary * properties = [[NSFileManager defaultManager] attributesOfItemAtPath:selectedVideoUrl.path error:&amp;error];
      NSNumber * size = [properties objectForKey: NSFileSize];
      NSLog(@"Vide info :- %@",properties);
  }
  </code></pre>
  
  <p>But there is nothing about duration of selected video. </p>
  
  <p>Thanks...</p>