Picture-in-picture (PiP) mode allows you to watch YouTube videos while using other apps.
If you are using Chrome browser, just double right-click on the YouTube video, and select Picture-in-picture option to play the video simultaneously over any window you have opened.
Your video will play on the lower right corner of your window. You can drag the PiP player to any area of your screen. Move your mouse cursor over the video to show controls.
Tap the X in the corner of the video to dismiss the PiP player.