![]() Lastly, we instantiate the MPMoviePlayerController class and pass it with the video URL for playback. So in this method, we first get the URL of the video (please note that this video is not saved in the photo library unless we do it explicitly). The file URL of the video is bundled in the info parameter. Play the video by using the MPMoviePlayerController class, which is a built-in class for the playback of a video from a file (or a network stream)Īs you know, the didFinishPickingMediaWithInfo: method will be called when user confirms to use the video.Get the system URL of the video just captured.In order to implement the video playback, there are a few things to be done: Once user finishes recording and confirm to save the video, the app will automatically play back the video in the main screen. As we need the picker to launch the video capture interface, we set the media type to kUTTypeMovie. By default the media type is set to kUTTypeImage, which designates the photo camera interface. Depending on the media types, the picker displays different interface for photos or videos. It’s almost the same as the one we use for taking photo, except that we set the picker’s media types to kUTTypeMovie. If you’ve read the previous tutorial, you should have a basic idea of UIImagePickerController. If you grasp the basics, however, you should have no problem utilizing the MPMoviePlayerViewController class. In this tutorial, we will focus on the MPMoviePlayerController. The MPMoviePlayerViewController class is designed to present a simple view controller for displaying full-screen movies. On the contrary, if you want to play a full screen video, for example by presenting the video modally, you should use the MPMoviePlayerViewController class. You can incorporate a movie player’s view into a view owned by your app. By using MPMoviePlayerController, playback occurs in a view owned by the movie player. a subview smaller than the full screen), you should use the MPMoviePlayerController. If you want to display a video immediately and inline (e.g. On top of that, the MediaPlayer framework brings us two main classes to display videos or movies. We’ll keep thing simple and start off by covering the MediaPlayer framework. However, if you need advanced features such as media asset management, media editing, track management, and others, you have to use the AVFoundation framework. If you just want to play a video, you can use the MediaPlayer framework, which allows us to play a video stored locally in our device, or from a remote location. The iOS API for recording and playing videos can be a little bit confusing for newcomers, as there are several options available. In this post, we’re going to create a similar application but for video recording and playback. ![]() In the previous post we covered how to create a simple camera app. Update: The post has been updated to support Xcode 5 and iOS 7. IOS Create a Simple App for Video Recording and Playback
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |