For default mode, when user starts Picture-In-Picture, the little windows starts at the latest position (latest pip window closed position).
Is there a way to set starting position like: top-left, top-right, bottom-left, bottom-right?
There is no way to set the starting position of an AVPictureInPictureController
.
There isn't really a reason to set the location (it's going to be on top of other apps, not your own), and the user can change the location of it at anytime, out of your control.
From the AVPictureInPictureController documentation:
If an app invokes PiP in a way that is not under the immediate direction of the user, it will be rejected by the App Store.
Also, it is also not suggested to create a subclass of AVPictureInPictureController
:
Do not subclass AVPictureInPictureController. Overriding this class’s methods is unsupported and results in undefined behavior.
Creating the functionality of this would require the use of private APIs anyways, and that's a guaranteed rejection by Apple.