iOS 9 added some really cool multitasking functionalities to select devices, such as the latest iPads. One of these functionalities is PiP, or Picture in Picture. In this chapter, we’ll have a look at some of these exciting features.
You want to let a user shrink a video to occupy a portion of the screen, so that she can view and interact with other content in other apps.
I’ll break the process down into small and digestible steps:
AVPlayerLayer. This layer will be used by a view controller to display the video.
VPlayerItemthat represents the video.
play()function on the player to start normal playback.
currentItem.statusproperty of your player and wait until the status becomes
ReadyToPlay, at which point you create an instance of the
pictureInPicturePossibleproperty of your controller. Once this value becomes
true, let the user know that she can now go into Picture in Picture mode.