1

使用 AVCam 我可以开始和停止视频录制。此方法开始录制:

-(void)captureOutput:(AVCaptureFileOutput *)captureOutput didStartRecordingToOutputFileAtURL:(NSURL *)fileURL fromConnections:(NSArray *)connections;

并停止录制:

-(void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error;

我的问题是如何暂停录制?查看 AVFoundation 我可以找到一个暂停方法:

-(void)captureOutput:(AVCaptureFileOutput *)captureOutput didPauseRecordingToOutputFileAtURL:(NSURL *)fileURL fromConnections:(NSArray *)connections

但我找不到让它发挥作用的方法。我搜索了很多,但似乎没有解决我的问题,所以请帮忙。先感谢您。

4

1 回答 1

0

将方法从 AVCam更改为CameraEngine怎么样?

    #import "CameraEngine.h"


- (void) startPreview
{
    AVCaptureVideoPreviewLayer* preview = [[CameraEngine engine] getPreviewLayer];
    [preview removeFromSuperlayer];
    preview.frame = self.cameraView.bounds;
    [[preview connection] setVideoOrientation:UIInterfaceOrientationLandscapeRight];

    [self.cameraView.layer addSublayer:preview];
}



    - (IBAction)startRecording:(id)sender
    {
        [[CameraEngine engine] startCapture];
    }

    - (IBAction)pauseRecording:(id)sender
    {
        [[CameraEngine engine] pauseCapture];
    }

    - (IBAction)stopRecording:(id)sender
    {
        [[CameraEngine engine] stopCapture];
    }
    - (IBAction)resumeRecording:(id)sender
    {
        [[CameraEngine engine] resumeCapture];
    }
于 2017-06-06T12:56:48.437 回答