Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone iOS屏幕捕获暂停_Iphone_Ios_Xcode_Screen Capture_Avassetwriter - Fatal编程技术网

Iphone iOS屏幕捕获暂停

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)

我正在尝试使用AVAssetWriter录制屏幕。 我可以成功启动并保存屏幕视频。 现在我想实施一个动作暂停。请任何人指导我如何实施。 这是我的截屏代码

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次的问题。