Support » Plugin: LazyLoad Plugin – Lazy Load Images, Videos, and Iframes » Lazy Loaded Youtube Video Requires 2 clicks to Play

  • Hello Everyone,

    First of all, i loved your plugin and it was exactly what i was looking for!

    The reason i am contacting you is that i found a small issue when enabling the “Replace Youtube videos by thumbnail” option.

    After clicking the thumbnail the video loads and tries to start playing but fails. After examining why is that happening i fell upon the Javascript function lazyLoadYoutubeIframe produced in /vendor/wp-media/rocket-lazyload-common/serc/Assets.php Line 242.

    Even though there you always add ?autoplay=1 ( so the video would start playing after the initial click on the image ), you have not added the “allow” attribute with an “autoplay” value.

    My workaround was to add the following

    ,e.setAttribute(\”allow\”, \”accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\”)

    just before


    again talking about /vendor/wp-media/rocket-lazyload-common/serc/Assets.php Line 242.

    I also though about catching the whole iframe element, which is inside noscript tags and replacing it with the image on click, but i didnt want to mess with the code too much.

    I would really appreciate it if you included a fix of your choice for this particular issue in a future update, so it would be safe updating the plugin without losing the functionality described above.

    Thank you in advance !

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Lazy Loaded Youtube Video Requires 2 clicks to Play’ is closed to new replies.