0

I tried to play a video by url in an AVPlayerViewController. The AVPlayerViewController is set in my storyboard and the segue connection is working properly, but the play button is crossed out and the video will not be played. So what can i do? I already tested creating the AVPlayerViewController programmatically and added "Allow Arbitrary Loads". Still not working.

performSegueWithIdentifier("videoImpression", sender: self)    

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    if (segue.identifier == "videoImpression") {
        let destination = segue.destinationViewController as! AVPlayerViewController
        let url = NSURL(string: "http://download.wavetlan.com/SVV/Media/HTTP/H264/Other_Media/H264_test8_voiceclip_mov_480x320.mov")
        destination.player = AVPlayer(URL: url!)
    }
}

screenshot of videoplayer

Michael Knoch
  • 151
  • 2
  • 5
  • 1
    it might be related to transport security, as url is used "http:", http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http – pkis Mar 16 '16 at 14:39
  • I had the same problem before. use this darling, hope be usefull https://stackoverflow.com/a/56822494/11654755 – Negar Nov 09 '19 at 11:53

1 Answers1

0

Maybe you forgot to play video?

destination.player?.play()
Kemal Can Kaynak
  • 1,638
  • 14
  • 26
  • I've created AVPlayerViewController on storyboard, prepare it with segue and it worked. If it doesn't solve your problem, you miss something else. – Kemal Can Kaynak Feb 28 '16 at 15:38