Embedded Youtube videos sometimes need to be clicked twice to start playing

Hi, @Aizada_M shared with me a small issue with their forum of which I couldn’t pinpoint the exact issue especially since it happened even with creating a new theme with no CSS, no JS, no component, with non-official plugins disabled.

When a Youtube video is embedded, it sometimes needs to be clicked twice before playing.

The issue also didn’t happen in safe-mode because if you open the site, and then navigate to the embedded video page, the problem simply doesn’t occur. :upside_down_face:

One of the ways to repro is to go directly to the embedded video page. If you open any other page, and you navigate (without reloading the tab!) naturally to a page where there is an embedded Youtube video, then the issue won’t occur. This is why I couldn’t reproduce it with safe mode: I wasn’t aware that I could append ?safe_mode=no_themes,no_plugins at the end of any URL, I would always go from https://my-discourse/safe-mode and then navigate…

Steps to repro:

  1. Go to https://meta.discourse.org/t/embedded-youtube-full-screen-bug-part-deux/52649/2?u=canapin

  2. Click Play. It should do nothing.

  3. Click play again. The video plays.

Steps to not repro:

  1. Go to https://meta.discourse.org

  2. Open the search, enter "Seems OK to me in fullscreen?", open to the first result in the same tab

  3. Click the video. It should play with 1 click.



This is not a bug. This is a plugin called lazyYT (lazy load) it creates a thumbnail for the YouTube videos to load only when clicking on it. :slightly_smiling_face:


Thanks for the info :+1:

I understand how it works by looking at the HTML code when I click.

But you may have misunderstood the issue.

The thumbnail is present in both cases.

And in both cases, when we click on the thumbnails, it actually loads the iframe, as expected regarding the lazy loading. But only in the second case, the video plays on a single click, which is the expected behavior.

The behavior of the first case I describe isn’t the expected one, and it’s bad from a user’s experience to click on the “play video” button (which is highlighted on hover) to see a black background, then a loading circle, and then the same thumbnail than before and the video didn’t start.


LazyYT is on the way out, we are not sure exactly when we are getting rid of it and with what, but it certainly is going to go (likely some time in the next 3-6 months)

This sadly means we are unlikely to spend much time debugging this quirk.


Yeah sorry maybe I misunderstood but that’s because since when I use Discourse the YouTube videos lazyYT plays with double click not with single click. And I thought the double click is the expected behavior. :slightly_smiling_face:


This is the kind of case where I’m happy the issue won’t be fixed because you’ll move to something else, which always imply that Discourse is evolving (for the best so far! :smile:) :+1: