# Small error in the console after clicking inside a loaded video

**URL:** https://meta.discourse.org/t/small-error-in-the-console-after-clicking-inside-a-loaded-video/283596
**Category:** Bug
**Created:** [October 26, 2023, 11:15pm UTC](https://meta.discourse.org/t/small-error-in-the-console-after-clicking-inside-a-loaded-video/283596 "2023-10-26T23:15:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [October 26, 2023, 11:15pm UTC](https://meta.discourse.org/t/small-error-in-the-console-after-clicking-inside-a-loaded-video/283596/1 "2023-10-26T23:15:47Z")

</div>

Related to:

- [https://github.com/discourse/discourse/pull/23807](https://github.com/discourse/discourse/pull/23807)
- [DEV: Show a loading spinner on video placeholders by oblakeerickson · Pull Request #24039 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/24039)

Here is a small video showing the issue:

It looks like removing the click listener here doesn’t work. The next time a click happens, the `video-placeholder-container` doesn’t exist anymore:

[https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/instance-initializers/video-placeholder.js#L16](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/instance-initializers/video-placeholder.js#L16)

Probably because of `bind` usage here:

[https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/instance-initializers/video-placeholder.js#L85](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/instance-initializers/video-placeholder.js#L85)

Maybe an easy solution would be to use `{ once: true }` in `addEventListener` instead?

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [October 27, 2023, 4:05pm UTC](https://meta.discourse.org/t/small-error-in-the-console-after-clicking-inside-a-loaded-video/283596/4 "2023-10-27T16:05:02Z")

</div>

Thanks for the fix @blake!

[https://github.com/discourse/discourse/pull/24141](https://github.com/discourse/discourse/pull/24141)

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [October 27, 2023, 4:07pm UTC](https://meta.discourse.org/t/small-error-in-the-console-after-clicking-inside-a-loaded-video/283596/5 "2023-10-27T16:07:51Z")

</div>

My pleasure! Thank you for reporting it and for the suggestion 🙂

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [October 27, 2023, 4:09pm UTC](https://meta.discourse.org/t/small-error-in-the-console-after-clicking-inside-a-loaded-video/283596/6 "2023-10-27T16:09:22Z")

</div>


