暂停/完成的视频在YouTube上当向上滚动到足够加载新帖时会自动开始播放

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 - General Game Discussion - Let's Play Zone

  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

6 个赞

Possibly related to this bugfix:

2 个赞

From what I can see on the linked topic it appears the issue is still happening @eviltrout

2 个赞

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 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.

4 个赞

So this does not happen in the scrolling down scenario?

No it doesn’t happen when scrolling down.

I have edited the topic to make this more clear.

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.

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

3 个赞

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.

1 个赞

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

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

13 个赞

Sorry to resurrect this, but I’ve noticed this starts happening now even when scrolling down. Not sure if something changed this bug recently to the worse, or if it’s a different bug altogether. Confirmed with several people in our instance. This makes video sharing threads quite unbearable, when the earlier videos start suddenly playing.

我也这么认为,无论是向上滚动还是向下滚动都会发生这种情况,并且会随机重播所有先前播放的视频(我想这与 Discourse 在主题中加载新内容时处理先前内容的方式有关,但说实话我不知道)。

我对这件事感到喜忧参半,我不认为人们应该期望一个来自600多篇帖子之上的视频会在你无休止地向下滚动一个大话题时继续播放?视频是不可见的,如果你向下滚动,它已经有一段时间不可见了。

例如,如果你想在浏览任何网站时长时间播放音频,可以在新标签页中打开它?

恕我直言,不应该这样。如果你暂停或结束了一个视频,它不应该仅仅因为你向下滚动就自动重播。(尽管标题有误导性,但这正是所描述的行为)

事实上,对于那些希望“人们在你浏览时继续播放”的人来说,有一个替代方案,如果他们觉得标签页方法太麻烦的话。

1 个赞

这看起来更好吗?

在 3.0 稳定版上仍然会发生这种情况。有趣的是,一个视频在向上滚动时刷新,向下滚动时仍然暂停,另一个随机视频则相反。向上滚动时保持暂停状态,向下滚动时刷新播放。

非常烦人

我们尚未在此处实施任何更改。

我们的计划是在未来一到两年内重建主题视图,这应该能改善现状。这没有简单的解决方法,我们已经尝试过了。

2 个赞