So, im having a lot of trouble playing a video inside a UIView in my Swift application. To start with, that might not even be the right way to do it. What I want to achieve is playing a video inside a rectangle at the top of the ViewController, eg not in fullscreen. But no matter what i try, as soon as I hit the play button it toggles fullscreen mode. How would I go about doing this? Thanks a lot guys
This is the code im using to play the video
@IBAction func feedConnect(_ sender: Any) {
let url = feedUrl.text
writeToFile(fileName: "connections", stringToWrite: url!)
let movieURL:NSURL? = NSURL(string: url!)
if let url = movieURL {
self.avPlayer = AVPlayer(url: url as URL)
self.avPlayerViewController.player = self.avPlayer
self.avPlayerViewController.entersFullScreenWhenPlaybackBegins = false
}
self.present(self.avPlayerViewController, animated: true, completion: {() -> Void in self.avPlayerViewController.player?.play()})
}
I want do play the video inside the gray rectangle like this: