PiP not launching from a WKWebview Sandboxed app

Hi, I am developing an app that has a WKWebView and it can open sites like Youtube. The app is sandboxed as it is meant to be uploaded to the mac App Store. It has a feature PiP where we start the native PiP by calling a browser Javascript where we tell the WKWEBView to fire the PiP. It works well when we are running the code from XCODE in Debug scheme. When we run the code from release mode by archiving it or directly from the build folder, the WKWebView is not able to fire the PiP Agent and thus the Native PiP window is not visible, while the site shows that PiP is opened and we can here the sound being played. But PiP window is not visible. I cannot see PiPAgent in activity monitor. Why does it not work from within the release build outside xcode. But when I try to run the build directly from the Finder in builds folder, this PiP feature does not work. Request technical help for this. Thanks!

I have been developing an app for a little while now. I have been building it without any entitlements/sandboxing, but I decided to try to turn on sandboxing, and I noticed the exact same issue.

The video player says “This video is playing in picture in picture”, and I can hear the audio, but the video doesn’t show up.

Additionally, there is an error that shows up in the video playback menu bar item.

I also see this error in the console which I suspect is related, but not positive:

0x114041e90 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=51324, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}

I tried adding these entitlements to my app, but that causes it to crash on startup. Supposedly they are reserved for Apple only.

I am on macOS sonoma 14.5 (23F79) on Apple Silicon M1

Just wanted to add that adding com.apple.PIPAgent to com.apple.security.temporary-exception.mach-lookup.global-name entitlement as referenced in this thread fixed it for me: https://developer.apple.com/forums/thread/756472

PiP not launching from a WKWebview Sandboxed app
 
 
Q