title: How can I stream radio in my iOS app? Swift and AVFoundation
body: <p>I am currently using AVFoundation. The problem is that if I find a .m3u the stream works but I can not find the .m3u for any radio station. I am trying to get this one to work. <a href="http://player.listenlive.co/35821" rel="nofollow">http://player.listenlive.co/35821</a></p>
  
  <p>Here is my code</p>
  
  <pre><code>   @IBOutlet weak var playButton: UIButton!
   var player:AVPlayer = AVPlayer(URL: NSURL(string: "http://player.listenlive.co/35821/en"))
  
  @IBAction func buttonPressed(sender: AnyObject) {
      toggle()
  }
  
  func toggle() {
      if playButton.titleLabel?.text == "Play" {
          playRadio()
      } else {
          pauseRadio()
      }
  }
  
  func playRadio() {
      player.play()
      playButton.setTitle("Pause", forState: UIControlState.Normal)
  }
  
  func pauseRadio() {
      player.pause()
      playButton.setTitle("Play", forState: UIControlState.Normal)
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
      playButton.setTitle("Play", forState: UIControlState.Normal)
  
  }
  </code></pre>