-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Lazy loading autoplay videos #697
Comments
I think I have to alter the markup here a little bit because you can use |
Yes, being able to use |
I will only have time to do this after 10.10.19. In general it should be easy so you can give it a try. |
Are you suggesting that I should implement this myself to test it? I would much rather wait for your implementation. It's not a pressing issue, and I better trust your code given your experience. |
You can do that using the unveilhooks extension if you do something like this (or a data attribute), after it has changed the preload value to
|
I just added the feature. You will need the following markup: <video
class="lazyload"
preload="none"
muted=""
data-autoplay=""
data-poster="poster.jpg"
src="src.mp4">
</video> |
Love your work @aFarkas |
@aFarkas The latest lazysizes version has been integrated into the beta version of the aforementioned WordPress plugin, and I can confirm that it's working as expected. Thank you so much for the great work! |
@aFarkas This is only working halfway for me. Using the markup above the following happens: Chrome Firefox |
@aerni |
@aFarkas Sure I can. To my clarification; Do you need the |
@aerni |
@aFarkas - this appears to only work when you use |
Also, interestingly (and I haven't had a chance to debug yet), the solution does not appear to work on iOS 13.2 - the video just never loads for me on Safari/Chrome/Brave (obviously, all use the same underlying engine) |
@aerni and @willstocks I can't really reproduce your issues. Here is my testcase: |
Thanks @aFarkas - I will take a look/will spin up a test case when I get
home.
For the time being, I don’t know if this helps:
https://willstocks.co.uk/ scroll down to the “MPOW” article (last one of
four)
…On Mon, 18 Nov 2019 at 20:56, Alexander Farkas ***@***.***> wrote:
@aerni <https://github.com/aerni> and @willstocks
<https://github.com/willstocks>
I can't really reproduce your issues. Here is my testcase:
https://output.jsbin.com/qijoziq
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#697?email_source=notifications&email_token=AKNX2AR66RRSPYOG5HS6DM3QUL6PRA5CNFSM4ITXC4UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEL4DYI#issuecomment-555205089>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKNX2ATMHFPVBHFWJT7JTALQUL6PRANCNFSM4ITXC4UA>
.
|
@aFarkas You're right. Your test case works as expected. I implemented your markup on my website but I still can't figure out why it's not working. The JS works as the class See here: https://stage.michaelaerni.ch/en/work/hyve |
@aerni |
@aFarkas I do have it included. It's bundled with Webpack in the import lazySizes from 'lazysizes';
import 'lazysizes/plugins/unveilhooks/ls.unveilhooks'; Funny enough; I just figured that it works fine when adding the <script src="https://afarkas.github.io/lazysizes/plugins/unveilhooks/ls.unveilhooks.min.js"></script> Seems to be an issue with importing the plugin and bundling with Webpack? |
@aFarkas - I've just taken a look at that testcase and it appears to work as expected. I believe that, for some reason, regardless of my markup including |
Hey @aFarkas the testcase is not working. |
Maybe this codepen will help someone - https://codepen.io/alex2407/pen/RwpJBJz Some observations:
Initial page load: Scrolling down until lazyloading happens: Ps. I have used a free placeholder video, in case it breaks any copyright let me know and I will replace it with anything else; it is meant to be purely educational w/o any copyright infringement intentions |
I have just tested and the webm seems to be loading once I open the page. In theory, when you use src then of course browser will load it once the HTML is parsed. |
I have just tried and in my case, it opens when I scroll down to the video itself. I am on OSX with Google Chrome. |
Doesn't seem to be SUPER happy on iOS (any browser - Safari, Chrome, Brave - all open the video full screen even when playsinline is set) |
@willstocks are you suggesting there is a bug or issue with my sample code? To be honest, my code is not meant to be used as a ready-copy-and-paste solution. But rather a guideline or reference to get started. If you can reproduce the bug, I think it's better to raise it as an actual bug issue. |
Hi @alexkuc - no, just lazyloaded video as a whole appears to still not be 100% happy autoplaying/playing inline on iOS. I did peek very quickly at your codepen, but I only see the poster image as I think webm video hasn't yet made its way to iOS (webm audio is though through a flag I think) |
I am completly new to this and I am trying to lazyload autoplay videos in my shopify stroe. Can someone guide me in the right direction on what I need to do ? |
I'm trying to lazy load autoplay videos, but they get loaded without scrolling. Any ideas how to make them work?
The text was updated successfully, but these errors were encountered: