title: AVPlayer Seek not accurate even with toleranceBefore: kCMTimeZero
body: <p>We have an app which plays a long mp3 file (1 hour long). We want to be able to play from set points within the file. But, when we do it, it is inaccurate by up to 10 seconds. </p>
  
  <p>Here's the code:</p>
  
  <pre><code>  let trackStart = arrTracks![MediaPlayer.shared.currentSongNo].samples
  
    let frameRate : Int32 = (MediaPlayer.shared.player?.currentItem?.asset.duration.timescale)!
  
    MediaPlayer.shared.player?.seek(to: CMTimeMakeWithSeconds(Double(trackStart), frameRate), 
      toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero)
  </code></pre>
  
  <ul>
  <li>We have to use AVPlayer because we need the better quality "spectral:" AVAudioTimePitchAlgorithm.</li>
  <li><p>We didn't have the problem with AVAudioPlayer, but (AFAIK) we have to use AVPlayer because we need the better quality "spectral:" AVAudioTimePitchAlgorithm.</p></li>
  <li><p>[Edit:] - The error is consistent - it always plays from the same (wrong) place for a given requested position. This is also true after restarting.</p></li>
  </ul>
  
  <p>Any help very much appreciated! Thanks</p>
  
  <p>[Edit:]</p>
  
  <ul>
  <li>We have already tried <code>preferredTimescale: playerTimescale</code></li>
  <li>Also tried <code>kCMTimeIndefinite</code> instead of <code>kCMTimeZero</code></li>
  </ul>