如何在 ios 应用程序 (objective-c) 中暂停视频录制
How to pause video recording in ios application (objective-c)
我可以使用 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
但我找不到让它发挥作用的方法。
我搜索了很多但似乎没有解决我的问题,所以请帮忙。
提前谢谢你。
改变方法怎么样
来自 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];
}
我可以使用 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
但我找不到让它发挥作用的方法。 我搜索了很多但似乎没有解决我的问题,所以请帮忙。 提前谢谢你。
改变方法怎么样 来自 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];
}