Add API for Hubspot Video

Status: Idea Submitted

The PostMessage method definitely used to work - I had it implemented for several popups I wanted to autoplay across our website and you can see some of the early conversation around it confirmed functionality in 2022 Slack

I think that they’ve changed how the video API functions since then? I poked around in the source code a bit and definitely looked different. The live code also definitely has comments on what things will eventually look like, which makes me think things are still in development?

On the plus side, getPlayer() now works with the video id, so you can use,

 let videoWrapper = modal.querySelector('.hs-video-widget')
 let videoId = videoWrapper.dataset.hsvEmbedId
 let video = window.hsVideoApi.getPlayer(videoId)

now instead of some convoluted logic for multiple players, or

let hsPlayer = hsPlayers[0];

for just one.

I also spent a lot of time trying to figure out how to get our videos to continue to autoplay on modal open. Seems like maybe there’s something sticky with the player message queing? Ironically, this “triggerPause()” function seems to work without issue.

It seems absolutely asinine that there would be an obvious, easy-to-use “pause” and not an easy-to-use “play” for this video tool.