YouTube app on Android supported this some time ago. If you were playing a video and then wanted to go to some other app, a small floating window appeared with that video playing.
It was then locked away behind YouTube Premium, and now YouTube (non-premium) occasionally bugs you to pay for the premium when you try switching to another app so that you can continue playback.
It was then locked away behind YouTube Premium, and now YouTube (non-premium) occasionally bugs you to pay for the premium when you try switching to another app so that you can continue playback.