macOS Sierra brings picture-in-picture videos. In Safari, Right–click (or Control–click) the video and choose Enter Picture-in-Picture. The video will change to a small floating window that you can position in any corner of the screen.
If you try this in YouTube though, you’ll see YouTube’s custom menu which does not currently show the picture-in-picture option. The trick to getting picture-in-picture to work with YouTube is to Right–click (or Control–click) on the video a second time and you’ll see a different menu with the picture-in-picture option, as shown below!
Hopefully YouTube will add the picture-in-picture option into their custom menu so it will work on the first Right–click (or Control–click).