title: Resume sound in AVAudioPlayer with swift
body: <p>I am trying to play a clip of sound that can be paused, resumed or stopped. My pause button works, and the action function for this button is shown below. However I cannot get my resume function to work. When I press the resume button no audio is played. I have read around online and the only tips I can find are to use the prepareToPlay() function and to set shortStartTimeDelay to a value greater than 0.0. I have tried both of these to no avail. </p>
  
  <p>timeAtPause is a global variable of type NSTimeInterval</p>
  
  <p>The action function for the pause button is as follows:</p>
  
  <p><code>@IBAction func pauseAllAudio(sender: UIButton) {
          timeAtPause = audioPlayer.currentTime
          audioPlayer.pause()
      }</code></p>
  
  <p>The action function for the resume button is as follows:</p>
  
  <pre><code>@IBAction func resumeAllAudio(sender: UIButton) {
      let shortStartDelay = 0.01
      audioPlayer.prepareToPlay()
      audioPlayer.playAtTime(timeAtPause + shortStartDelay)
  }
  </code></pre>
  
  <p>Any tips on how to resume the audio would be really appreciated. 
  Thank you for your time.</p>