In RPBroadcastSampleHandler not called `processSampleBuffer`

I want to implement screen recording similar to Teams, WhatsApp... I created an Upload Broadcast Extension. If I start the extension, both audio and video will start to be recorded (without CallKit).

Issue:

During an ongoing call (CallKit), the extension starts, but does not start recording. Called broadcastStarted(withSetupInfo:) but not called processSampleBuffer(_:, with:). The extension stops after a short while.

  • How do I setup ReplayKit to work together with CallKit?
  • Is it possible that the CallKit audio setting does not allow ReplayKit recording?
  • Is it possible to turn off audio in ReplayKit and request only video?

I found out that RPBroadcastSampleHandler does not have a problem directly with CallKit. The problem is that I use AVSampleBufferDisplayLayer to display during a video call.

My problem is that if I use AVSampleBufferDisplayLayer.preventsCapture = true, the RPBroadcastSampleHandler extension does not start.

I expected from the preventsCapture setting that only that part of the image would not be recorded. 

Is it possible to keep this setting while still allowing screen recording to work?