title: In AVAudioPlayer after a pause the song does not continue on Swift
body: <p>In AVAudioPlayer after a pause the song does not continue, start again on Swift. Problem is when I choose Pause button and again Play button then It should start from starting.</p>
  
  <pre><code>import UIKit
  import AVFoundation
  class DetailViewController: UIViewController {
  
  let musicArray:[String] = ["reamon", "sandman"]
  
  var audioPlayer: AVAudioPlayer?
  
  var songIndex:Int = 0
  
  @IBAction func pauseButton(sender: AnyObject) {
      audioPlayer!.pause()
  
  }
  
  @IBAction func playButton(sender: AnyObject) {
  
      let mySound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource(musicArray[songIndex], ofType: "mp3")!)
  
      do{
          audioPlayer = try AVAudioPlayer(contentsOfURL: mySound)
          audioPlayer!.prepareToPlay()
          audioPlayer!.play()
      } catch {
          print("Error getting the audio file")
      }
  
  }
  
  @IBOutlet weak var stopButtonOutlet: UIButton!
  
  @IBAction func stopButton(sender: AnyObject) {
      audioPlayer!.stop()
      audioPlayer!.currentTime = 0
  }
  
  func playSongAtIndex(index: Int) {
  
      songIndex = index
  
  }
  </code></pre>