A new experimental Chrome Extension called FacePause pauses a YouTube video when you look away from the screen. It uses an API called FaceDetector that has been available in Chrome since version 56. The extension is currently an experimental feature and has to be enabled before it can be used. Even with the feature on, Chrome wont use your web cam without getting permission from you. For me the FacePause extension did not work, but your mileage may vary. For me, the face detection failed to work.
Source: https://www.bleepingcomputer.com/news/google/facepause-chrome-extension-pauses-a-youtube-video-when-you-look-away/