Youtube scrolling bug


(Chris Saenz) #1

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:

Another one here:


#2

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.


(Chris Saenz) #3

Well, lets try it with a different one.


#4

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.


(Chris Saenz) #5

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


#6

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


(Chris Saenz) #7

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.


(Jeff Atwood) #8

Yep I can repro this @eviltrout


(Robin Ward) #9

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

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.


Embedded YouTube videos autoplay randomly when scrolling up
(Chris Saenz) #10

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.


(Jeff Atwood) #11