My goal is to enable Picture-in-Picture (PiP) on an HTML video by using the code below:
await videoElement.requestPictureInPicture().catch((error) =>
alert(`PiP failed, ${error}`);
);
While this code works perfectly in Safari, I encountered an issue when adding the website to the home screen with
"display": "standalone"
set in the manifest. The error message indicates that picture-in-picture is not supported and the built-in PiP control is missing from the video player.
I am curious as to why this discrepancy exists or if there is a workaround for it. I initially assumed that the PWA/standalone version utilizes the same browser/js engine as regular Safari, but it appears that might not be the case?