Play Vimeo Embed Video only when in viewport

Hey guys,

In the portfolio section of my site I decided to integrate a header video embed with Vimeo. I want to have the video only play in viewport and pause when out of viewport, is there a way to do this? I’ve tried everything but couldn’t find any threads/articles.