lozad.js icon indicating copy to clipboard operation
lozad.js copied to clipboard

fix: call load on audio elements

Open mihar-22 opened this issue 4 years ago • 2 comments

👋

I'm currently building a media player library and about to release version 2. I added lozad.js to provide lazy loading of media/iframe elements out of the box. I noticed that audio elements weren't loading because the load method is not called on audio elements. This patch simply ensures we call the HTMLMediaElement.prototype.load method on <audio> elements.

mihar-22 avatar Aug 09 '20 07:08 mihar-22

@mihar-22 I'd love to merge this PR. Will be great if you can add details in README and an example in Demo page as well.

ApoorvSaxena avatar Aug 11 '20 00:08 ApoorvSaxena

Thanks for getting back so quickly @ApoorvSaxena. I've added the examples but unfortunately it doesn't work at the moment. Everything seems right and the audio element is intersecting, the load method should be called but it isn't. Weirdly it logs the audio element right before calling load but it never happens? Due to time I'll need to come back to this a bit later, apologies.

mihar-22 avatar Aug 11 '20 02:08 mihar-22