Perform the following steps to add a video:
- Let's, as usual, create a new Xcode project with the Single View Application template called PlayingWithVideos.
- For the demo app, we have downloaded the 1280 * 720 (5 MB) file to use in testing.
Ensure that you have copied the video file in the Xcode project, as we will read the file from the main bundle.
- We will use AVPlayerViewController to display the video file. To embed a view controller in the ViewController screen that we have, we will use the Container view that we talked about earlier.
- Go to Object Library and drag a Container view with the following constraints:
Container.leading = Superview.leading Container.trailing = Superview.trailing Container.height = 250 Container.top ...