Open Bug 1893615 Opened 1 year ago Updated 9 months ago

Youtube shorts starts playing when another video is played in fullscreen

Categories

(Core :: DOM: Events, defect, P2)

Firefox 125
defect

Tracking

()

Tracking Status
firefox133 --- ?

People

(Reporter: xracoonx, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0

Steps to reproduce:

Opened a youtube shorts video but stopped it from playing. Later played a movie in another tab.

Actual results:

The youtube shorts video started playing all of a sudden (together with the movie).

It happens regularly but I have not found a recipe to recreate it reliu
ably.

Expected results:

The shorts video isn't playing.

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Hmm, not able to reproduce this but it does seem odd. Reliable STR would be useful so we can debug.

Severity: -- → S3

Hellö

i also have that bug and its reproducable quite easily...

  1. have youtube shorts tab open, probably have watched a couple of those things so there is a "history"
  2. get bored, pause shorts, open new tab and find other video to watch, either a "normal" youtube video, or a video on a different website, i can confirm imgur and prime video to also trigger it, plus some adult and illegal streaming sites but i guess i shouldnt name those here...
  3. put other video into fullscreen and let it play
  4. youtube shorts tab will jump backwards in the "history" to a short from like half an hour ago or so and make it play, you will notice by having the sound from the short disturb your fullscreen video
  • depending on the websites playback behaviour the trigger varies, if the website autoplays the video just setting the paused or playing video to fullscreen will trigger it, on websites that wait for you to push play you actually have to do that for the bug to trigger, websites that autoplay on fullscreen obviously also trigger on fullscreen...
  • pausing the fullscreen vid will not pause the shorts
  • non-fullscreen will not trigger the shorts tab
  • pushing the shorts tab to a new window will also avoid the bug

FF is 126.0.1 64bit, ublock, noscript, win10home 22H2

addition:
just tested a bit with it, you definitely need a "history", just opening the first short youtube suggests to you wont do it apparently, you gotta scroll down and actually have watched some of those things it seems, needed 4 or 5 for the bug to appear, but not reliably, and it would only jump back like 1 short or not at all and just play the currently paused one, so you really need to watch that nonsense for like half an hour to get the full "jump backwards like a dozen shorts" experience and reliably trigger the bug on every occasion...

hope that helps!

gl fixing :)

I am also having this bug. It's as RecurringNightmare says, it takes a few shorts for it to kick in but it is consistently doing it to me, no extensions on. Fresh install too, I've tried everything I can think of to fix it on my end.

Alastor Wu, please tell these users what profiler settings would be more appropriate for your team to be able to investigate this issue.

Note: I'm not affected by this.

Flags: needinfo?(alwu)

So far I wasn't able to reproduce this on the latest Nightly. If anyone has a robust STR to reproduce this problem, could you please try to capture a profiled result by this instructions? However, after the step of Select Media Playback preset, please replace the log modules with timestamp,HTMLMediaElement:5,Autoplay:5 then follow the rest of steps to start profiling, thanks!

Flags: needinfo?(alwu)

Okay, now I can reproduce this issue, I don't know why they start reloading Short video when users interacts with video in another tab. I can sometime reproduce this issue by putting another video into fullscreen.

Profile 1 (with log) : https://share.firefox.dev/3S028sr
Proifle 2 (with screenshot) : https://share.firefox.dev/4bGg5mi


In profile1, I can confirm that Youtube started reloading a new source for its background Youtube Short. As that tab has been activated by the user before, it's allowed to autoplay. Therefore, the tab started playing sound even if it's in the background.

In profile2, I captured the screenshot by Firefox profiler, but that result doesn't contain any log. I made video playback into fullscreen around 10.9s (process 48392) and then Youtube short started loading new source around 12.2s (process 40436)


Smaug, do you have any idea about this issue? I wonder if Firefox incorrectly dispatch some DOM events to trigger Youtube to do wrong thing, or it's a bug in their player. Thanks!

Flags: needinfo?(smaug)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2

You can filter using DOMEvents to see any interesting events there. Looks like process 40436 gets a resize event. Is resizing a window enough to trigger loading in background?

Flags: needinfo?(smaug) → needinfo?(alwu)

It appears that the window resize event is triggering the resource reload. Is it reasonable to send a window resize event to a background YouTube tab? If so, the issue might be that YouTube should not reload its video when the tab is in the background. If not, are we incorrectly dispatching the resize event?

According to the spec, resize event should be dispatched when the viewport is changed. But if the tab is in the background already, it shouldn't have any viewport at all because all content are invisible.

Flags: needinfo?(alwu) → needinfo?(smaug)

Additionally, when moving a regular YouTube video to a different Firefox window, separate from the one displaying YouTube Shorts. Making video fullscreen won't trigger Youtube Short reload, because no window resize event will be received in the Youtube short tab.

Hellö

awesome to see people actually trying to fix this as its kinda niche and not critical, just annoying, that kind of bug or issue often gets little attention

im of little help regarding all that technical stuff, but i wanted to add some points just in case:
shorts seems to be primarily aimed at phone users and not for people on a desktop pc with full functionality, originally it didnt have things like volume control or a seekbar, and it still lacks the ability to put the video into fullscreen mode, which might be part of the bug actually, there is a function being used elsewhere that shorts doesnt understand hence it reacts in weird ways...
to me it seems the app "thinks" its always in fullscreen mode, like on a phone, and phones also dont really have browser tabs afaik, you just get a new browser window actually, so the shorts app doesnt "know" that tabs are a thing, it only checks if its in a foreground or background window in order to know if it should play or not, but the possibility of it being in a foreground window but a background tab doesnt seem to be a considered option when coding that app...

keep up the good work and good luck fixing :)

Resize events should be fired if rAF is triggered https://html.spec.whatwg.org/#event-loop-processing-model
Per the profile 2 there are also other things waiting for rAF
"RefreshDriverTick - Tick reasons: HasObservers (1x Animation event flush observer, 1x Resize event flush observer, 1x Style flush observer) NeedsToUpdateAnimations HasPendingMediaQueryListeners HasVisualViewportResizeEvents HasScrollEvents"

It is unclear to me which of those need to happen in background tab.
Or should we not run RefreshDriver at all in background https://searchfox.org/mozilla-central/rev/b3c85ac11d004fdb582577cd8f674efa44b0e253/layout/base/nsRefreshDriver.cpp#1302-1305 ?

Flags: needinfo?(smaug)

The reason of autoplay for Youtube short is that Youtube short received an event (or being informed by observer) to reload its video when the tab is still in the background. The event seems window resize event. The comment 10 also proved this by moving Youtube tab to another window, then the issue can't be reproduced.

As this is related with DOM event, move this to another component.

Component: Audio/Video: Playback → DOM: Events
Summary: Youtube shorts starts playing when another video is played → Youtube shorts starts playing when another video is played in fullscreen

Please tag someone on the DOM team. Users are still creating support threads about this.

I confirm that there is a problem on 128.3.1esr (x32). Please pay attention to this issue.

You need to log in before you can comment on or make changes to this bug.