相关疑难解决方法(0)

Replaykit,startCaptureWithHandler()不在captureHandler中发送视频类型的CMSampleBufferRef

我已经实现了一个RPScreenRecorder记录屏幕和麦克风音频.多次录制完成后,我停止录制并使用视频合并Audios,AVMutableComposition然后将所有视频合并为单视频.

对于屏幕录制和获取视频和音频文件,我正在使用

- (void)startCaptureWithHandler:(nullable void(^)(CMSampleBufferRef sampleBuffer, RPSampleBufferType bufferType, NSError * _Nullable error))captureHandler completionHandler:
Run Code Online (Sandbox Code Playgroud)

用于停止录制.我叫这个功能:

- (void)stopCaptureWithHandler:(void (^)(NSError *error))handler;
Run Code Online (Sandbox Code Playgroud)

这些都很直接.

大部分时间它都很棒,我收到视频和音频CMSampleBuffers.但有时会发生这种情况,startCaptureWithHandler只发送音频缓冲区但不发送视频缓冲区. 一旦我遇到这个问题,它将不会发生,直到我重新启动我的设备并重新安装应用程序.这使我的应用程序对用户来说不可靠.我认为这是一个重播工具包问题,但无法与其他开发人员发现相关问题.如果你们中的任何一个遇到这个问题并得到解决方案,请告诉我.

我已多次检查但未在配置中看到任何问题.但无论如何它在这里.

NSError *videoWriterError;
videoWriter = [[AVAssetWriter alloc] initWithURL:fileString fileType:AVFileTypeQuickTimeMovie
                                           error:&videoWriterError];


NSError *audioWriterError;
audioWriter = [[AVAssetWriter alloc] initWithURL:audioFileString fileType:AVFileTypeAppleM4A
                                           error:&audioWriterError];

CGFloat width =UIScreen.mainScreen.bounds.size.width;
NSString *widthString = [NSString stringWithFormat:@"%f", width];
CGFloat height =UIScreen.mainScreen.boNSString *heightString = [NSString stringWithFormat:@"%f", height];unds.size.height;

NSDictionary  * videoOutputSettings= @{AVVideoCodecKey : AVVideoCodecTypeH264,
                                       AVVideoWidthKey: widthString,
                                       AVVideoHeightKey : heightString};
videoInput  = [[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeVideo outputSettings:videoOutputSettings]; …
Run Code Online (Sandbox Code Playgroud)

ios replaykit rpscreenrecorder

7
推荐指数
1
解决办法
2738
查看次数

标签 统计

ios ×1

replaykit ×1

rpscreenrecorder ×1