Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazyloading videos with muted attribute is not working #999

Open
alexchakmakov opened this issue Jun 25, 2024 · 0 comments
Open

Lazyloading videos with muted attribute is not working #999

alexchakmakov opened this issue Jun 25, 2024 · 0 comments
Labels

Comments

@alexchakmakov
Copy link

Hello everyone. I'm having the following markup

<video class="lazyload"
       preload="none"
       data-autoplay=""
       loop=""
       playsinline=""
>
    <source src="VIDEO_URL" type="video/mp4">
</video>

This setup works perfectly, as evidenced by the network tab showing that only 22 out of 60 videos load initially, with more videos loading incrementally as I scroll down (24, 26, 28, 30, etc.).

However, the problem arises when I add the muted attribute to the videos. When the videos have the muted attribute, it seems that lazysizes fails, and all 60 videos load immediately on page load. What could be causing this issue?

Please note the following:

  • I've included the unveilhooks plugin
  • The videos are dynamically added to the DOM.
  • I am using a masonry JavaScript library.
  • I have an IntersectionObserver that plays the videos when they enter the viewport and pauses them when they exit.

Thanks in advance for you help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant