我正在尝试创建应用程序,用户可以从相机录制视频.此应用程序的一个功能必须是暂停文件记录.例如:按"开始"按钮后的用户开始记录.一段时间后,用户按"暂停"按钮,视频录制暂停.然后用户按"恢复"按钮,视频继续录制在同一文件中.有谁能够帮我?谢谢.
WBR Maxim
设置 AVCaptureSession 和 AVAssetWriter,然后您可以使用布尔值“isRecording”打开或关闭录制。
BOOL isRecording;
-(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
{
if(videoWriterInput.readyForMoreMediaData && isRecording) [videoWriterInput appendSampleBuffer:sampleBuffer];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5125 次 |
| 最近记录: |