Take the 2-minute tour ×

Im building an app that allows the user to record a video (in app) by pressing a button on the main screen. I don't want the user to be taken to the photo app because the video will only be able to be viewed on the app (Max of 15 seconds) and I can't quite get it. Anyone have the code to do this? A good example of what i want the camera to do is the camera in the app Cinemagram. Thanks for any help.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

If you plan on saving the movie to the user's photo library, then you can use UIImagePickerController. In particular, you should read the guide that accompanies the class.

However, if you only want the video to be temporary, then you will probably want to use AVFoundation. You would then need to configure an AVCaptureSession with an AVCaptureMovieFileOutput to write the video to disk. Then, when you are ready to play the video, create an AVURLAsset with the file url that you just wrote, use that to create an AVPlayer to play the video, and add an AVPlayerLayer to your view, with said player, to display the video.

Either way, I would recommend studying the examples that Apple provides. AVCam and AVPlayerDemo should be more than enough to get you started (especially the AVCam example project).

share|improve this answer
thanks. This was actually exactly the kind of answer i wanted. Thanks for the links. –  nfoggia Oct 18 '12 at 7:40
do you know of any apple documentation for the same thing but with iOS6? –  nfoggia Oct 24 '12 at 21:47
add comment

Your Answer


