I have a button ,when i press it i want to show a movie from the web.
this is my code :
@IBAction func trailersClicked(sender: UIButton) {
let videoURL = NSURL(string: "https://www.youtube.com/watch?v=fhD7hXrpExE")
let player=AVPlayer(URL: videoURL!)
let playerViewController=AVPlayerViewController()
playerViewController.player=player
self.presentViewController(playerViewController, animated: true) { ()->Void in
playerViewController.player?.play()
}
}
after the button was pressed i see the player but the movie doesn't play.
I have added the App Transport Security Settings
with
Allow Arbitrary Loads
set to true.