# Paused/finished YouTube videos automatically start playing when scrolling up far enough to load new posts

**URL:** https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692
**Category:** Bug
**Created:** [2월 21, 2017, 12:05오전 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692 "2017-02-21T00:05:08Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![tortoiseontour](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tortoiseontour/32/513684_2.png) [@tortoiseontour](https://meta.discourse.org/u/tortoiseontour)
#### Post date: [2월 21, 2017, 12:05오전 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/1 "2017-02-21T00:05:08Z")

</div>

If a YouTube video in a post is paused or finished playing and you scroll up ~~or down~~ the page enough to load new posts, the aforementioned video will start playing automatically. I’ve successfully recreated this issue on Windows 7 in Chrome version 56.0.2924.87 in this thread: [Post your favorite video game glitches - #74 by jacknife - Game Discussion - Let's Play Zone](https://www.lp.zone/t/post-your-favorite-video-game-glitches/1233/74)

1. Load the post in the page above
2. Play one or all of the videos in the post
3. Pause them at any point
4. **Scroll up** the page until the browser loads in new comments
5. The videos will autoplay without any interaction

Here’s a thread about it on my forum if it’s of any help: [Embedded Youtube Video Replaying - Site Feedback - Let's Play Zone](https://www.lp.zone/t/embedded-youtube-video-replaying/122)

---

<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: [2월 22, 2017, 2:12오전 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/2 "2017-02-22T02:12:58Z")

</div>

Possibly related to this bugfix:

> [@Youtube scrolling bug](https://meta.discourse.org/t/youtube-scrolling-bug/40237/9):
>
> 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: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [5월 9, 2017, 5:55오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/3 "2017-05-09T17:55:28Z")

</div>

From what I can see on the linked topic it appears the issue is still happening @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: [5월 11, 2017, 8:35오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/5 "2017-05-11T20:35:21Z")

</div>

I have spent a lot of time this afternoon on this issue and I feel like this issue might not be fixable unless someone else has a brilliant idea.

The problem is in the virtual DOM with prepending (scrolling up). In this case, you are adding a bunch of elements (posts) to the beginning of an array. When the virtual DOM does its diff, it notices the element with the youtube `<iframe>` is not in the same place, so it removes and re-adds it later. This causes the youtube player to refresh the iframe, which causes it to play again.

It seems [impossible](http://stackoverflow.com/a/8318401/165668) to move an `<iframe>` in the DOM without reloading it.

Note that this bug doesn’t happen when scrolling down because appending posts doesn’t change the order. It also doesn’t matter if the user hasn’t started the video already, because lazyYT hasn’t inserted the iframe yet.

---

<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: [5월 11, 2017, 8:38오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/6 "2017-05-11T20:38:46Z")

</div>

So this does not happen in the scrolling down scenario?

---

<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: [5월 11, 2017, 8:39오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/7 "2017-05-11T20:39:16Z")

</div>

No it doesn’t happen when scrolling down.

---

<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: [5월 11, 2017, 8:41오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/8 "2017-05-11T20:41:51Z")

</div>

I have edited the topic to make this more clear.

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [7월 30, 2017, 3:22오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/9 "2017-07-30T15:22:12Z")

</div>

A similar bug happens if you don’t stop the video. When you scrolling up the page, the video stops and after few seconds restart from the beginning.

---

<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: [8월 2, 2018, 9:59오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/10 "2018-08-02T21:59:32Z")

</div>

I wonder if @Osama could take a look at this? It is annoying, and easy to repro.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [8월 7, 2018, 3:26오전 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/12 "2018-08-07T03:26:24Z")

</div>

OK our debugging shows that for some reason the Youtube embedded player did fix the autoplay thing, so I am fixing the title here.

The bug we have is that we have “protection” in place when you click play that tells the “post cloaker”, hi … don’t cloak me. But this protection is somehow binned when you scroll up.

This means that if you play a song on youtube and scroll up it will just stop playing when we load the next chunk.

---

<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: [8월 7, 2018, 3:38오전 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/13 "2018-08-07T03:38:15Z")

</div>

> [@sam](#):
>
> This means that if you play a song on youtube and scroll up it will just stop playing when we load the next chunk.

It’s also the opposite, if you stopped it playing, it will now restart.. by itself.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [4월 15, 2019, 7:11오전 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/14 "2019-04-15T07:11:28Z")

</div>

This has been assigned both to @eviltrout and @Osama over the years, we have invested lots of time here and simply can not come up with a fix.

I am tagging this #pr-welcome … but keep in mind … difficulty level on this is somewhere around 11.

 ![image](https://global.discourse-cdn.com/meta/original/3X/d/2/d2f21f394199bef574adbc28fbf679837c1a9a6c.jpeg)

---

<div class="post-metadata">

### Author: ![polkaparrot](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@polkaparrot](https://meta.discourse.org/u/polkaparrot)
#### Post date: [7월 15, 2021, 12:58오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/15 "2021-07-15T12:58:47Z")

</div>

이 스레드를 다시 꺼내게 되어 죄송합니다. 하지만 이제 아래로 스크롤할 때도 이런 문제가 발생하기 시작했다는 걸 알게 되었습니다. 최근에 이 버그가 더 나빠졌는지, 아니면 아예 다른 버그인지 확실하지 않습니다. 저희 인스턴스에서 여러 사람과 확인해 보았습니다. 이전 영상이 갑자기 재생되기 시작하면 영상 공유 스레드가 꽤 견디기 힘들어집니다.

---

<div class="post-metadata">

### Author: ![Iceman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iceman/32/181309_2.png) [@Iceman](https://meta.discourse.org/u/Iceman)
#### Post date: [11월 14, 2021, 6:46오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/23 "2021-11-14T18:46:18Z")

</div>

동의합니다. 위로든 아래로든 스크롤을 하면 이전에 재생했던 영상이 무작위로 다시 재생됩니다. (토론 주제에서 새 내용을 로드할 때 Discourse가 이전 내용을 처리하는 방식과 관련이 있을 것 같지만, 솔직히 정확한 원인은 모르겠습니다.)

---

<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: [12월 2, 2021, 2:08오전 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/24 "2021-12-02T02:08:17Z")

</div>

이 문제에 대해서는 복합적인 감정을 가지고 있습니다. 600개 이상의 게시물 위에 있는 영상이, 메가토픽에서 끝없이 아래로 스크롤하는 동안 계속 재생되어야 한다는 기대를 사람들이 가져야 한다고 생각하지 않거든요. 아래로 스크롤 중이라면 해당 영상은 보이지도 않고, 이미 한동안 보이지 않았을 테니까요.

예를 들어, 웹사이트를 둘러보면서 오랫동안 오디오를 재생하고 싶다면 새 탭에서 여는 건 어떨까요?

---

<div class="post-metadata">

### Author: ![Iceman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iceman/32/181309_2.png) [@Iceman](https://meta.discourse.org/u/Iceman)
#### Post date: [2월 7, 2022, 4:43오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/25 "2022-02-07T16:43:42Z")

</div>

제 생각에는 그렇지 않아야 합니다. 영상이 일시정지되었거나 종료된 상태라면, 단순히 아래로 스크롤했다는 이유만으로 자동으로 다시 재생되어서는 안 됩니다. (제목은 다소 오해의 소지가 있지만, 설명된 동작은 바로 이렇습니다.)

사실, 탭 접근 방식이 너무 부담스럽게 느껴지는 사용자를 위해, 화면을 이동하는 동안에도 “영상이 계속 재생되도록” 하는 [대안](https://meta.discourse.org/t/media-overlay-component/81418)이 있습니다.

---

<div class="post-metadata">

### Author: ![Aleksey\_Bogdanov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aleksey_bogdanov/32/288040_2.png) [@Aleksey\_Bogdanov](https://meta.discourse.org/u/Aleksey_Bogdanov)
#### Post date: [1월 14, 2023, 11:19오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/35 "2023-01-14T23:19:12Z")

</div>



---

<div class="post-metadata">

### Author: ![Aleksey\_Bogdanov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aleksey_bogdanov/32/288040_2.png) [@Aleksey\_Bogdanov](https://meta.discourse.org/u/Aleksey_Bogdanov)
#### Post date: [1월 16, 2023, 1:06오후 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/36 "2023-01-16T13:06:15Z")

</div>

이렇게 하면 더 나아 보이나요?

---

<div class="post-metadata">

### Author: ![Foriusz](https://avatars.discourse-cdn.com/v4/letter/f/a698b9/32.png) [@Foriusz](https://meta.discourse.org/u/Foriusz)
#### Post date: [1월 22, 2023, 11:10오전 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/37 "2023-01-22T11:10:25Z")

</div>

3.0 안정판에서도 여전히 이 문제가 발생합니다. 재미있는 점은, 위로 스크롤하면 한 영상은 새로고침되지만, 아래로 스크롤하면 여전히 일시정지 상태라는 것입니다. 또 다른 랜덤한 영상은 그 반대 현상을 보이는데, 위로 스크롤할 때 일시정지되고 아래로 스크롤할 때 재생이 새로고침됩니다.

정말 짜증납니다

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [1월 23, 2023, 5:47오전 UTC](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692/38 "2023-01-23T05:47:20Z")

</div>

아직 이 부분에 대한 변경 사항을 구현하지 않았습니다.

우리는 향후 1~2년 내에 주제 보기(topic view)를 재구성할 계획이며, 이를 통해 상황이 hopefully 개선되기를 기대하고 있습니다. 여기에는 쉬운 해결책이 없으며, 우리는 이미 시도해 보았습니다.

[다음 페이지](https://meta.discourse.org/t/paused-finished-youtube-videos-automatically-start-playing-when-scrolling-up-far-enough-to-load-new-posts/57692.md?page=2)
