Android 7.0 introduced picture-in-picture (PiP) mode back in 2016. Now it is possible to shrink a playing video down to a floating window that shows at the top of all other content, enabling users to continue watching a video while doing another job. Back then the time PiP mode was just available for Android TVs so not many people were able to benefit from it. Now with Android O PiP mode is going to be there on all Android devices with screens much smaller than a TV’s that includes phones as well as tablets. But, as Android O is so new and few developers have had the time and means to update their apps, it's not easy to look for an app that supports PiP at the moment. Fortunately, the team at XDA Developers has found a way to trigger PiP mode manually in any app, even in case it hasn't been updated to work with Android O in particular.
The process is very simple and merely a question of mapping the correct key to the navigation bar. You will find that PiP works well for a YouTube video, though the video faces some resizing problems and some bugs once in a while during playback.
Learn Also: How to Update an Android Phone?
To enable PiP mode manually, you just have to go into the System UI Tuner, add a cursor button to the navigation bar and map it to keycode number 171 that triggers a KEYCODE_WINDOW event. Next, you need to press the little cursor on your navigation bar should toggle PiP mode.
This method is a kind of a hack for apps that still don't support PiP as such, so you should not expect everything to work just in the perfect way. However, these minor issues will get smoothened up when Android O makes it way to the phones later in 2017.