Loading & Playing MP4 when centered in viewport

[ad_1]

I posted this last week and a couple people mentioned the intersection observer API. I have fair knowledge of CSS, HTMl, and JS and figured with ChatGPT I might be able to pull this off.

Basically- I’m using a plugin to display posts (content views plugin). The posts are loaded using AJAX. When the user is scrolling and the featured image is centered on the screen I want a MP4 to load and play. *this is a common feature many video streaming websites have*

I tried using the observer API to change the featured image to an MP4 with a URL for the video that’s taken from a meta field of the post. I made a dozen attempts with different approaches in 6 hours and eventually gave up.

My guesses: *AJAX* Idk how AJAX works but after reading a little documentation it sounds like this might be the issue. I also think it’s *The plugin itself*.

I couldn’t find any plugins that do this for listing blog posts and I would pay money for this feature.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer