AVCaptureSessionを使ってiOS5.0用の動画アプリを作っています。ユーザーがムービーの録画を開始、一時停止、開始、停止できるようにしています
私が定義した3つのボタンは
録音開始
記録を停止
録音を一時停止
録音を正常に開始および停止できます。私ができないことは、録音を一時停止してから再開することです。スタックオーバーフローに関するこの質問/回答を見ましたが、ビデオを一時停止および再開する方法がわかりませんか? ここで他の投稿を見つけましたが、試してみるために使用できるサンプルコードはありません。AVAssetWrtier が適切な方法である場合、AVCaptureSession でどのように使用しますか?
iOS で AVFoundation を使用して同じファイルのビデオ キャプチャを一時停止および再開する
これが3つのボタンの私のコードです
-(IBAction) makeMovieNow
{
NSLog(@"makeMovieNow ...");
[session startRunning];
[movieFileOutput startRecordingToOutputFileURL:movieURL recordingDelegate:self];
}
-(IBAction) makeMovieStop
{
NSLog(@"makeMovieStop ...");
//stop recording
[session stopRunning];
}
-(IBAction) makeMoviePause
{
NSLog(@"makeMoviePause ...");
//pause video??? How?
}
//********** DID FINISH RECORDING TO OUTPUT FILE AT URL **********
- (void)captureOutput:(AVCaptureFileOutput *)captureOutput
didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
fromConnections:(NSArray *)connections
error:(NSError *)error
{
NSLog(@"didFinishRecordingToOutputFileAtURL - enter");
BOOL RecordedSuccessfully = YES;
if ([error code] != noErr)
{
NSLog(@"ERROR RECODING MOVIE!!! - enter");
// A problem occurred: Find out if the recording was successful.
id value = [[error userInfo] objectForKey:AVErrorRecordingSuccessfullyFinishedKey];
if (value)
{
RecordedSuccessfully = [value boolValue];
}
}
if (RecordedSuccessfully)
{
//----- RECORDED SUCESSFULLY -----
NSLog(@"didFinishRecordingToOutputFileAtURL - success");
UISaveVideoAtPathToSavedPhotosAlbum(videoPath2, self, nil, nil);
}
}