I want to write a little iOS video client and have to use HTTP Live Streaming. The videos come from a Wowza Media Server which supports HTTP Live Streaming, so the server-si
Below is my Swift 4 solution with AVPlayer
[since MPMoviePlayerController is deprecated in iOS 9]
import UIKit
import AVKit
...
class VideoPlayerViewController: UIViewController {
var player: AVPlayer?
override func viewDidLoad() {
super.viewDidLoad()
guard let url = URL(string: "http://stream-url.com/file.m3u8") else {
print("Umm, looks like an invalid URL!")
return
}
player = AVPlayer(url: url)
let controller = AVPlayerViewController()
controller.delegate = self
controller.player = player
// present the player controller & play
present(controller, animated: true) {
self.player?.play()
}
}
}