I apologize, I'm more of an instructional designer, versus a JavaScript Wizard. So far, my experience with xAPI has been limited to sending statements from Storyline to the xAPI wrapper, and then in turn to an LRS.
For this situation, I have an MP4 video playing in a pop-up window, and I need to trigger an xAPI statement each time my video windows ceases to be the "active" window on the user's system. My research on Stack Overflow leads me to believe that using the window.onblur event would be the easiest way, but I don't understand how to code the function each time that event happens, in order to send the xAPI statement.
I've been all over the internet looking for someone who has done this in xAPI before, to no avail. I appreciate any advice you more experienced folks can offer.