title: Get the accurate duration of a video
body: <p>I'm making a player and I want to list all files and in front of all files I want to present the duration of the video.</p>
  
  <p>The only problem is that I'm not getting the right video duration, sometimes it return a duration completely wrong.</p>
  
  <p>I've tried the below solution:</p>
  
  <pre><code>let asset = AVAsset(url: "video.mp4")
  
  let duration = asset.duration.seconds
  </code></pre>
  
  <p>So that it, the time sometimes give a value sometimes another.
  if someone know a possible solution I'm glad to heard.</p>
  
  <p>I have update the code using one possible solution but it didn't work well,</p>
  
  <pre><code>let asset = AVAsset(url: url)
  
  let duration = asset.duration
  
  let durationTime = CMTimeGetSeconds(duration)
  
  let minutes = Double(durationTime / 60)
  </code></pre>
  
  <p>I've tried with a video of 11:47 minutes of duration and it returns me = 11:78, how could a video have 11 minutes and 78 seconds?</p>
  
  <p>So I think the problem is with the video, and I picked another video of 1:16 minutes and again the returned value is 1:26 (10 seconds wrong)</p>