3

I am trying to use the AVCaptureVideoPreviewLayer with PiP like this:

if #available(iOS 15.0, *) {
    let pipVideoCallViewController = AVPictureInPictureVideoCallViewController()
        pipVideoCallViewController.preferredContentSize = CGSize(width: 160, height: 160)
        pipVideoCallViewController.view.addSubview(videoView)
        
        let pipContentSource = AVPictureInPictureController.ContentSource(
                                    activeVideoCallSourceView: videoView,
                                    contentViewController: pipVideoCallViewController)
        
        let pipController = AVPictureInPictureController(contentSource: pipContentSource)
        pipController.canStartPictureInPictureAutomaticallyFromInline = true
        
        pipController.startPictureInPicture()
    } else {
        // Fallback on earlier versions
    }

But I am receiving the following error every time I start the PiP:

-[PGPictureInPictureProxy (0x119965290) _updateAutoPIPSettingsAndNotifyRemoteObjectWithReason:] - Acquiring remote object proxy for connection <NSXPCConnection: 0x28364fca0> connection to service with pid 64 named com.apple.pegasus failed with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 64 named com.apple.pegasus was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 64 named com.apple.pegasus was invalidated from this process.}

If I don't connect in the ContentSource, my view present the video but if I connect the layer disappears.

Matheus Weber
  • 194
  • 2
  • 3
  • 14

0 Answers0