![]() Next, add the following class extensions at the end of the file. MobileCoreServices contains predefined constants such as kUTTypeMovie, which you’ll need later on. Importing AVKit gives you access to AVPlayer, which plays the selected video. Start by opening PlayVideoViewController.swift and add the following import statements at the top of the file: For example, to add the values of an array to an initial value of 10.0: let items 2.0,4.0,5.0,7.0 let total items.reduce(10.0, +) // 28.0. The reduce method takes two values, an initial value and a combine closure. In this section of the tutorial, you’ll add the code to select a video file and play it. Use reduce to combine all items in a collection to create a single new value. The Select and Play Video button on the main screen segues to PlayVideoController. Only the three buttons in the initial scene do anything, but you’ll change that soon! The main screen contains the three buttons below, which segue to other view controllers:īuild and run and test the buttons. This project contains a storyboard and several view controllers with the UI for a simple video playback and recording app. Open the starter project and look around. Ready? Lights, cameras, action! Getting Startedĭownload the project materials by clicking the Download Materials button at the top or bottom of the tutorial. A free account will work just fine for this tutorial. To do that, you’ll need to be a registered Apple developer. In other words, you really need to test this code on a device! Plus, you’ll need to figure out a way to add videos to the media library manually.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |