The following JavaScript code locates the first video element on the page, removes the attributes that may be blocking the PIP feature, and attempts to open the video in picture-in-picture mode.
var v = document.getElementsByTagName("video").item(0);
v.removeAttribute("disablepictureinpicture");
v.requestPictureInPicture();