Iphone iOS屏幕捕获暂停
我正在尝试使用AVAssetWriter录制屏幕。 我可以成功启动并保存屏幕视频。 现在我想实施一个动作暂停。请任何人指导我如何实施。 这是我的截屏代码Iphone iOS屏幕捕获暂停,iphone,ios,xcode,screen-capture,avassetwriter,Iphone,Ios,Xcode,Screen Capture,Avassetwriter,我正在尝试使用AVAssetWriter录制屏幕。 我可以成功启动并保存屏幕视频。 现在我想实施一个动作暂停。请任何人指导我如何实施。 这是我的截屏代码 NSError* error = nil; videoWriter = [[AVAssetWriter alloc] initWithURL:[self tempFileURL] fileType:AVFileTypeQuickTimeMovie error:&error]; NSParameterAssert(videoWriter)
NSError* error = nil;
videoWriter = [[AVAssetWriter alloc] initWithURL:[self tempFileURL] fileType:AVFileTypeQuickTimeMovie error:&error];
NSParameterAssert(videoWriter);
//Configure video
NSDictionary* videoCompressionProps = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithDouble:1024.0*1024.0], AVVideoAverageBitRateKey,
nil ];
NSDictionary* videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:
AVVideoCodecH264, AVVideoCodecKey,
[NSNumber numberWithInt:self.frame.size.width], AVVideoWidthKey,
[NSNumber numberWithInt:self.frame.size.height], AVVideoHeightKey,
videoCompressionProps, AVVideoCompressionPropertiesKey,
nil];
videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];
NSParameterAssert(videoWriterInput);
videoWriterInput.expectsMediaDataInRealTime = YES;
NSDictionary* bufferAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:kCVPixelFormatType_32ARGB], kCVPixelBufferPixelFormatTypeKey, nil];
avAdaptor = [AVAssetWriterInputPixelBufferAdaptor assetWriterInputPixelBufferAdaptorWithAssetWriterInput:videoWriterInput sourcePixelBufferAttributes:bufferAttributes];
//add input
[videoWriter addInput:videoWriterInput];
[videoWriter startWriting];
[videoWriter startSessionAtSourceTime:CMTimeMake(0, 1000)];
有人建议我录制多个文件并合并。这是一种合适的方式吗?我认为视频合并需要一些时间
请给我一些建议
谢谢我也和你一样在做同样的事情。我可以暂停并继续1次。我还试图解决暂停和继续录制超过1次的问题。