Apple's camera app seems to save video straight to the photos album. I'm wondering if that capability can be accomplished by us mere mortal developers.
Both methods I've come across and tested, copy a video file to the photos album. The larger the file, the longer it takes to save. A 2 minute creation can vary in the save time. Two timings I have are, 45 seconds, and 1 minute 12 seconds to copy to copy files about 150MB in size. A file of similar size from the Apple Camera app can take as little as 6 seconds.
I've looked at the AVCam demo code and it uses one of the two methods I've already tested.
I'm using AVFoundation to connect to the camera and open up a stream to a file. For context, the following is where I open that file. The movieURLPath a file reference in my apps document directory area.
When the file has been closed by stopping the recording, I eventually get to this line.
Does anyone have any other options to speed up the writing process? Clearly my preference would be to have movieURLPath pointing to a file in the PhotosAlbum. It would be optimal to open the file in that folder instead, which is what I think Apple has done.
Both methods I've come across and tested, copy a video file to the photos album. The larger the file, the longer it takes to save. A 2 minute creation can vary in the save time. Two timings I have are, 45 seconds, and 1 minute 12 seconds to copy to copy files about 150MB in size. A file of similar size from the Apple Camera app can take as little as 6 seconds.
I've looked at the AVCam demo code and it uses one of the two methods I've already tested.
ALAssetsLibrary instance method writeVideoAtPathToSavedPhotosAlbum:completionBlock:
UIKit Function UISaveVideoAtPathToSavedPhotosAlbum
UIKit Function UISaveVideoAtPathToSavedPhotosAlbum
I'm using AVFoundation to connect to the camera and open up a stream to a file. For context, the following is where I open that file. The movieURLPath a file reference in my apps document directory area.
Code:
outputWriter = [AVAssetWriter assetWriterWithURL: [projectPaths movieURLPath] fileType: AVFileTypeQuickTimeMovie error: &error];
When the file has been closed by stopping the recording, I eventually get to this line.
Code:
UISaveVideoAtPathToSavedPhotosAlbum ([projectPaths movieFilePath], self, @selector(video:didFinishSavingWithError: contextInfo:), nil);
Does anyone have any other options to speed up the writing process? Clearly my preference would be to have movieURLPath pointing to a file in the PhotosAlbum. It would be optimal to open the file in that folder instead, which is what I think Apple has done.