I had a black screen and background sound thats example code:
override func viewDidLoad() {
super.viewDidLoad()
playVideo()
}
func playVideo() {
let videoURL = URL(string: "http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8")
let player = AVPlayer(url: videoURL!)
player.rate = 1
player.appliesMediaSelectionCriteriaAutomatically = true
var playerViewController = AVPlayerViewController()
playerViewController.player = player
playerViewController.allowsVideoFrameAnalysis = true
DispatchQueue.main.async {
self.present(playerViewController, animated: true) {
playerViewController.player!.play()
}
}
}