# Youtube scrolling bug

**URL:** https://meta.discourse.org/t/youtube-scrolling-bug/40237
**Category:** Bug
**Created:** [2016年二月26日 18:55 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237 "2016-02-26T18:55:37Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![ky\_metro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ky_metro/32/42807_2.png) [@ky\_metro](https://meta.discourse.org/u/ky_metro)
#### Post date: [2016年二月26日 18:55 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/1 "2016-02-26T18:55:37Z")

</div>

Youtube bug in the new virtual DOM. Tested in Firefox and Chrome stable.

Repro:

- Play a Youtube video embedded in a post, and scroll up or down **but the post itself is still visible**.
- The URL bar will refresh as another post (before or after) becomes visible.
- The video should continue playing. Instead, it reloads, beginning playback again from the beginning.
- Every time the URL updates and the containing post is partly visible (even if the video itself is offscreen) it will reload.
- If you scroll up or down until the containing post is offscreen, the video stops and doesn’t reload until you click it again.

See example here:

> [@What would be a good way to deal with duplicate posts?](https://meta.discourse.org/t/what-would-be-a-good-way-to-deal-with-duplicate-posts/40215/6):
>
> [[Matrix Architect Scene] ](https://www.youtube.com/watch?v=ZKpFFD7aX3c&t=2m26s) All of them have merit. Priorities must be set clear on what is most desirable; mitigating (or outright extinguishing) the utmost undesirable of behaviors, fostering others, through any means those in power wish to do at their Will; to come about the conclusion as to how they, and you, see this community. This is an answer, I feel, that leans toward structured, groomed content. Depends on the community in any given context, if that is more valued. Del…

Another one here:

[https://meta.discourse.org/t/the-end-of-clown-vomit-or-simplified-category-styles/24249/144](https://meta.discourse.org/t/the-end-of-clown-vomit-or-simplified-category-styles/24249/144)

---

<div class="post-metadata">

### Author: ![purldator](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@purldator](https://meta.discourse.org/u/purldator)
#### Post date: [2016年二月26日 19:01 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/2 "2016-02-26T19:01:22Z")

</div>

This may be related to YouTube links that start the video from a specific spot.

For instance, the example you linked involved the video starting @ 2:26.

This is the precise URL I used for that post: `https://youtu.be/ZKpFFD7aX3c?t=2m26s`

Otherwise, confirmed from my side based on your repro steps.

---

<div class="post-metadata">

### Author: ![ky\_metro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ky_metro/32/42807_2.png) [@ky\_metro](https://meta.discourse.org/u/ky_metro)
#### Post date: [2016年二月26日 19:02 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/3 "2016-02-26T19:02:32Z")

</div>

Well, lets try it with a different one.

[https://meta.discourse.org/t/the-end-of-clown-vomit-or-simplified-category-styles/24249/144?u=ky\_metro](https://meta.discourse.org/t/the-end-of-clown-vomit-or-simplified-category-styles/24249/144)

---

<div class="post-metadata">

### Author: ![purldator](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@purldator](https://meta.discourse.org/u/purldator)
#### Post date: [2016年二月26日 19:08 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/4 "2016-02-26T19:08:37Z")

</div>

The repro steps in your OP did not conjure the same bug as seen from my post. RE: simplified category styles post.

I start that video, scroll down, the video stops. I scroll back up, press play anew, let it run a bit then scroll up; it stops. Intended behavior. I am on latest Chrome/Windows 10.

So, this narrows down to videos that start from a spot specified in the URL.

---

<div class="post-metadata">

### Author: ![ky\_metro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ky_metro/32/42807_2.png) [@ky\_metro](https://meta.discourse.org/u/ky_metro)
#### Post date: [2016年二月26日 19:10 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/5 "2016-02-26T19:10:08Z")

</div>

> [@purldator](#):
>
> I start that video, scroll down, the video stops.

That’s interesting. For me it did the same thing as repro steps, restarted playing. I’m on latest Chrome / Win10 too.

---

<div class="post-metadata">

### Author: ![purldator](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@purldator](https://meta.discourse.org/u/purldator)
#### Post date: [2016年二月26日 19:10 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/6 "2016-02-26T19:10:53Z")

</div>

Try disabling all your plugins/extensions? Then test anew.

---

<div class="post-metadata">

### Author: ![ky\_metro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ky_metro/32/42807_2.png) [@ky\_metro](https://meta.discourse.org/u/ky_metro)
#### Post date: [2016年二月26日 19:27 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/7 "2016-02-26T19:27:52Z")

</div>

After some experimenting, I’ve updated the repro steps. Its more tied to the post which contains the video, not the video itself.

Keep a tiny bit of that video’s post onscreen as you scroll around, and the video will reload every time the URL updates. Once the post goes offscreen, the video stops.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016年二月26日 20:39 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/8 "2016-02-26T20:39:41Z")

</div>

Yep I can repro this @eviltrout

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [2016年二月26日 22:14 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/9 "2016-02-26T22:14:15Z")

</div>

I’ve got a fix here for the video restarting when scrolling to different posts:

[https://github.com/discourse/discourse/commit/65d7103bdc20d597decaeefa6ae9c782d6d51aaa](https://github.com/discourse/discourse/commit/65d7103bdc20d597decaeefa6ae9c782d6d51aaa)

As for it stopping when offscreen: that’s the result of our cloaking, which tries to save memory by unloading things as they scroll off. We might be able to increase the threshold before this happens, or perhaps add a check to see if there’s a video playing, but I think it’s less serious of a bug.

---

<div class="post-metadata">

### Author: ![ky\_metro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ky_metro/32/42807_2.png) [@ky\_metro](https://meta.discourse.org/u/ky_metro)
#### Post date: [2016年二月26日 22:36 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/10 "2016-02-26T22:36:25Z")

</div>

> [@eviltrout](#):
>
> As for it stopping when offscreen: that’s the result of our cloaking, which tries to save memory by unloading things as they scroll off. We might be able to increase the threshold before this happens, or perhaps add a check to see if there’s a video playing, but I think it’s less serious of a bug.

I’m all for turning a bug into a new feature. Facebook does this too, right?

Unless you’re listening to music, I can’t see needing to keep the video running offscreen.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016年二月27日 00:24 UTC](https://meta.discourse.org/t/youtube-scrolling-bug/40237/11 "2016-02-27T00:24:29Z")

</div>


