Bulit a Custom Video Player using UIKit & Programmatic UI, a couple of days ago.
One of the things I've been wanting to explore and create a tutorial on for some time is a full internal + external Picture-in-Picture player in UIKit, just like YouTube and Apple TV.
Getting AVPlayerLayer to support native PiP inside the app (without presenting a view controller) required a lot less work than I had initially expected. I also added playback controls, a custom retry button, and a dynamic progress bar — all layered right over the video.
For external PiP, I had to ensure it keeps playing even when the app is in the background — with full support for iOS 14+ and background modes enabled.
Liked the project? Just give it a star ⭐️ and spread the word!
© Shubham Kumar Singh | 2025