小编Die*_*goQ的帖子

使用WebRTC的ReplayKit在重复进入后台后停止工作

我正在使用WebRTC创建点对点连接以共享屏幕和音频.我正在使用ReplayKit捕获屏幕,生成CMSampleBufferRef; 使用我可以创建RTCVideoFrame.

为了得到CMSampleBufferRef我正在使用:

[[RPScreenRecorder sharedRecorder] startCaptureWithHandler:^(CMSampleBufferRef  _Nonnull sampleBuffer, RPSampleBufferType bufferType, NSError * _Nullable error)
Run Code Online (Sandbox Code Playgroud)

到目前为止,一切都很完美.

当我开始将应用程序发送到后台并多次返回时,问题就出现了; 然后ReplayKit停止调用他的捕获处理程序.只有当我发送CMSampleBufferRef到WebRTC时才会发生这种情况,因此很明显ReplayKit问题与WebRTC有关.如果我从代码中删除此行,则问题不会发生(显然WebRTC不起作用).

[self->source capturer:self->capturer didCaptureVideoFrame:videoFrame];

我能让它再次工作的唯一方法是重启设备.甚至杀死应用程序并重新启动也不起作用.

这是我RTCVideoTrack在视图控制器中创建的方式:

- (RTCVideoTrack *)createLocalVideoTrack {

   self->source = [_factory videoSource];

   self->capturer = [[RTCVideoCapturer alloc] initWithDelegate:self->source];

   [self->source adaptOutputFormatToWidth:441 height:736 fps:15];

   return [_factory videoTrackWithSource:self->source trackId:@"ARDAMSv0"];
}
Run Code Online (Sandbox Code Playgroud)

下面是我转换CMSampleBufferRefRTCVideoFrame并发送至的WebRTC:

- (void)didCaptureSampleBuffer:(CMSampleBufferRef)sampleBuffer {

  if (CMSampleBufferGetNumSamples(sampleBuffer) != 1 || !CMSampleBufferIsValid(sampleBuffer) ||
    !CMSampleBufferDataIsReady(sampleBuffer)) {
    return;
  }

  CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
  if (pixelBuffer == …
Run Code Online (Sandbox Code Playgroud)

objective-c ios webrtc replaykit

7
推荐指数
0
解决办法
457
查看次数

使用 WordPress 配置 apple-app-site-association 文件

我正在尝试实现 iOS 通用链接,我需要在我的 WordPress 的根目录中提供一个 apple-app-association 文件。

如何Content-type: "application/pkcs7-mime"在 WordPress 中提供我的 apple-app-association 文件?

我试过直接上传,当然不行,因为我需要修改apple-app-association的Content-type为: Content-type: "application/pkcs7-mime"

php wordpress ios ios-universal-links

2
推荐指数
3
解决办法
4824
查看次数