Video desyncs with audio after Youtube ads if Bluetooth headphones are used
Categories
(Core :: Audio/Video: Playback, defect)
Tracking
()
People
(Reporter: gserg.g, Unassigned, NeedInfo)
References
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0
Steps to reproduce:
When Bluetooth headphones are in use, Firefox seemingly does the little dance required to align the video playback in accordance to the delay introduced by Bluetooth, which would not be present when using wired headphones. This can be seen in the form of a 1 - 1.5 second stutter at the beginning of a playback when Bluetooth headphones are connected, and this is good.
The problem is that when Youtube injects an ad, which it does approximately every four minutes, this synchronization falls apart, and after you click the Skip button in the Youtube ad player (which you do the millisecond it becomes clickable), you realize the audio and video are now very misaligned in the video you were watching.
The only way to fix this ad-induced desync that I am aware of is to disconnect the headphones completely from the system and reconnect them. Then Firefox recognizes the change in hardware and performs the synchronization dance again. Because this has to be done every four minutes or so, it is very annoying.
Using Windows 11 Pro 23H2 on an HP laptop with a built-in Bluetooth, and Samsung Galaxy buds (gen 1).
Comment 1•2 months ago
|
||
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.
I gave this a try on Firefox stable on Windows 10 and was unable to repro. Is this new behavior for you? On stable, disconnecting / reconnecting my bluetooth headphones caused the sync dance to occur, but after the ad injection video playback resumed as expected. On nightly, there was no delay during connection / reconnecting whatsoever. Would you be able to give Firefox Nightly a try and see if that clears up the issue for you? If it doesn't, would you able to capture a profile using the Firefox Profiler using the media preset, upload it, and then paste the link here? The video here has step-by-step instructions on how to capture a profile. Thanks!
(In reply to az [:az] from comment #2)
I gave this a try on Firefox stable on Windows 10 and was unable to repro. Is this new behavior for you?
No, this was always the case, in many previous versions too, I just never got round to report it, so probably no reason to try nightly.
Frankly, the desync also happens/worsens as you progress from one video to another, it's just that it's more instant and prominent with ads.
I also find, as an end user, that Windows 10 is superior to Windows 11 in all ways that matter to an end user, and I will not be surprised to learn that this is actually a Windows 11 problem. Still, I thought it would be worth to report it as Firefox is seemingly able to sync the audio at will, when it knows to do so.
after the ad injection video playback resumed as expected
Did you click the Skip button?
would you able to capture a profile using the Firefox Profiler using the media preset, upload it, and then paste the link here?
As I cannot invoke youtube ads at will, that will likely be a huge capture? Any hints on how to make it quick and small?
I did press the skip button during my testing as fast as it appeared. :jimm will see if he can repro from our side on his W11 box.
As a heads-up, the profiler uses a ring buffer, so it's constantly cycling old profiling data out of memory to make memory for new data and the capture size shouldn't exceed 1GiB. This can be changed under the settings if that's too large for your machine, though it'd be great if you could leave it at the default. I mentioned Nightly since it did seem to improve performance on my side, even though I didn't run into the same issue you did.
Hmmm..... I could not reproduce it myself either when I just sat and watched the video until an ad, having Firefox as my only active window and not interacting with anything else. And I'm pretty sure I saw Firefox doing the audio resync after the ad too.
Then I retraced my steps and it would appear what plays a role is the Picture in Picture mode.
Very often I watch youtube by moving the video into a PiP window and minimizing the Firefox main window. The video plays in the bottom right corner of the screen while I'm doing something else in another program.
When an ad starts, I quickly un-PiP the video into the main Firefox window to get to the Skip button, press it as soon as it appears, and move my video back to PiP. But it is already desynced.
Profile of that: https://share.firefox.dev/4fkCeIy
Here the desync did happen, but it was not very profound at all. I had to squint my eyes to confirm it.
I also was able to reproduce the same by simply pausing and unpausing the video quickly, not involving PiP!
If you unpause after some noticeable time has elapsed since pausing, then a resync visibly happens, and all is well. But if you unpause quickly, within, say, two-three seconds, the resync does not occur, and a desync happens, and it may be very slight or not so much. Profile of that: https://share.firefox.dev/4gzLfPi.
And the worst offender seems to be not even related to ads :(
It's when you:
- watch a video in one tab
- pause it
- middle-click a recommended video from the right hand side column so that it opens in a new tab, and that tab says "AUTOPLAY BLOCKED" in its tab title
- switch to that tab and unpause the video
Massive desync results. And it cannot even be fixed by subsequent pausing, waiting for a long time, and unpausing.
Profile of that: https://share.firefox.dev/4gfjMlY.
:kinetik, would you have any ideas here?
Description
•