title: Playing HLS (m3u8) in Cocoa OS X AVPlayer - Swift
body: <p>Basically I am trying to play an m3u8 (HLS Live Stream) using AVPlayer in Cocoa Swift.  I'm relatively new to the language, so basically grabbed some <a href="http://qiita.com/ono_matope/items/23d22aeeb663ff5fe2ac" rel="nofollow">example code</a> for playing local video files and tried modifying it to play a live stream... But get this instead:</p>
  
  <p><a href="http://i.stack.imgur.com/bU9GM.png" rel="nofollow">http://i.stack.imgur.com/bU9GM.png</a></p>
  
  <p>This is what I got so far (commented lines are to play local file, which does work):</p>
  
  <pre><code>import Cocoa
  import AVKit
  import Foundation
  import AVFoundation
  
  class ViewController: NSViewController {
  
      @IBOutlet weak var playerView: AVPlayerView!
  
      var videoPlayer:AVPlayer!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          //let path = NSBundle.mainBundle().pathForResource("sample", ofType: "mov")
          //var fileURL = NSURL(fileURLWithPath: path!)
          let fileURL = NSURL(string: "http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8")
          let avAsset = AVURLAsset(URL: fileURL!, options: nil)
  
          let playerItem = AVPlayerItem(asset: avAsset)
          videoPlayer = AVPlayer(playerItem: playerItem)
          playerView.player = videoPlayer
          videoPlayer.play()
      }
  
      override var representedObject: AnyObject? {
          didSet {
              // Update the view, if already loaded.
          }
      }
  }
  </code></pre>
  
  <p>Any help on how to make this code work, or lead me in the right direction is much appreciated!</p>