Android N is now available to download on the Nexus Player and that adds a lot of new features to the OS, one of which is picture in picture (PiP). Like multi-window, more than a single app can appear on a screen at the same time. However, this second app is supposed to be a video which runs in a corner of the screen. This makes it easier for a user to keep watching a video as they browse for another video.
Video demo of PiP (at 0:42)
Developer hitherejoe, the same who created the Vine client Vineyard for Android TV, has published a new open source project on GitHub. Users can pull it and compile the app through Android Studio. The app lets users pick between two looping timelapses and place those videos in PiP mode. Then you’re able to navigate through the OS while still watching that video.
For developers, the code to integrate this feature in their app is not very elaborate. Key elements are adding attributes to your manifest stating your activity supports picture-in-picture and then override methods to handle the PiP lifecycle. Hitherejoe has a blog post explaining how he wrote the app in greater detail.
If you’re building a media app, you should look at the project’s code to figure out how to integrate PiP in your own projects.