When my video completes, I want it to pull down the AVPlayer and return to the Main View Controller.
I also want to pull the video down from my external screen/display when that's connected.
How do I do this?
I've tried a few different answers on here and none of them have worked so far.
NOTE: Four is the name of my video
@IBAction func fourVideoPlayButton(_ sender: Any) {
if let path = Bundle.main.path(forResource: "Four", ofType: "mp4") {
let fourVideo = AVPlayer(url: URL(fileURLWithPath: path))
let fourVideoPlayer = AVPlayerViewController()
fourVideoPlayer.player = fourVideo
present(fourVideoPlayer, animated: true, completion: {
fourVideo.play()
})
}
}