title: How to AVAudioPlayer with progress bar show using swift?
body: <p>I'm playing a song using <code>AVAudioPlayer</code>. I need a progress bar to show the progress of the song.</p>
  <p>My issue is that the progress bar's progress isn't working properly. Within 2-3 seconds, it finishes its progress.</p>
  <pre><code>func playMusic() {
  
      do {
          player = try AVAudioPlayer(contentsOf: (currentSong?.mediaURL)!)
          guard let player = player else { return }
  
          player.prepareToPlay()
          player.play()
  
  
          updater = CADisplayLink(target: self, selector: #selector(self.musicProgress))
          updater.frameInterval = 1
          updater.add(to: RunLoop.current, forMode: RunLoop.Mode.common)
  
          playButton.setImage(UIImage.init(named: &quot;pause&quot;), for: .normal)
      } catch let error as NSError {
          print(error.description)
      }
  }
  
  @objc func musicProgress()  {
  
      let normalizedTime = Float(self.player?.currentTime as! Double * 100.0 / (self.player?.duration as! Double) )
      self.progressMusic.progress = normalizedTime
  }
  </code></pre>