Twitter videos block sleep mode (since Plasma 6.2)

My computer would not go to sleep after a period of time, even though the “After a period of inactivity” option was active.

I found out via “Power and Battery” that this was because the activity manager was blocking it.

Each video viewed on Twitter in Firefox increases the number:

Watching videos on YouTube does not cause the problem.

What is the solution to the problem?

Operating System: Fedora Linux 40
KDE Plasma Version: 6.2.2
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Kernel Version: 6.11.4-201.fc40.x86_64 (64-bit)
Graphics Platform: Wayland

1 Like

Can someone confirm the bug? If there is no solution, then I will report the bug.

Can not replicate on

Operating System: Arch Linux
KDE Plasma Version: 6.2.2
KDE Frameworks Version: 6.7.0
Qt Version: 6.8.0
Kernel Version: 6.11.6-arch1-1 (64-bit)
Graphics Platform: Wayland
and with Firefox 132.0-1

Sleep and Screen Locking is only blocked while a Twitter/X Video is actively playing on screen (like I would like) as soon as stopped or scrolled past that Video the block goes away.
One issue, though, I have set firefox to block autoplay Video and Audio on all websites and Twitter/X seems to somehow circumvent that setting and plays them, at least without Audio, anyway.

And because I don’t have a Twitter/X account not sure if it would behave different when logged in.

ideally you should be able to click on the “firefox: video-playing” and open the tab or window that is playing so you can intervene but nvm that.

I also have a similar issue that while nothing is playing anywhere (its all paused) sleep is still blocked. xdotcom was closed and it didn’t fix the issue.

maybe this is a firefox or browser extension related issue?

also this qt bug [QTBUG-127340] (for some goofy reason this site doesn’t allow posting links so I have just included bug ids) causing this list of KDE issues [bug_id=493203%2C493355%2C493834%2C493860%2C493863%2C493904%2C493945%2C493981%2C493993%2C494038%2C494260%2C494310%2C494508%2C494595%2C494644%2C494783%2C494855%2C494862%2C494999%2C495240%2C495281%2C495292%2C495365%2C495515&list_id=2888586] has a chance of also being the cause of this.

Thanks. After further testing, I found that it wasn’t about logging out, but about the speed at which the videos were scrolling.

Can you try scrolling quickly through x.com or x.com? There are a lot of videos.

1 Like

maybe this is a firefox issue?

Yes FF+Twitter+Plasma 6.2. There is no problem with the Opera browser. I haven’t tested Chrome. Before version Plasma 6.2 there was no problem.

browser extension related issue?

I’ll try.

It is now blocking almost 1000 videos, but no video is currently playing:

Please consider the QT issue as it causes stuff in the system tray to have duplicate and persistent entries. there are multiple dozen kde bugs caused by this qt bug for example: discuss.kdedotorg/t/ghost-dvds-kde-thinks-there-are-mutliple-of-the-same-dvds-despite-unpluging-reader/24815) you will have to change “dot” to . in the address to get to it as this annoying site doesn’t allow links (even to itself) or you can look at my profile maybe.

If it was the QT bug it would explain why in my impression even with these (possibly bugged) do not sleep entries my computer still seems to go to sleep.

OK. I’ll wait for Qt 6.8.1.

I might install the git master version of QT to see if it does fix my disk issue and this issue.

I could try it, but I don’t know how to install Qt 6.8.1 on Fedora.

6.8.1 is not out yet and is set to release on the 21st with this and many other fixes since it looks like a bug fixing dev cycle. but it looks like the fix is merged in master already. I am going to try it tomorrow maybe.

turns out we just have to wait until the 21st or whatever as git breaks a bunch of otherstuff and would require recompiling half the qt6 apps on my system.

OK.

Note: I tried Chrome. No problem. The bug is only on Firefox.

I also have this issue - not only with Twitter but also with YouTube and other sites. To the best of my understanding, Firefox will request a sleep block if any tab has a video player on it, even if it’s not playing, and possibly for some background workers (I have YouTube notifications working, and sleep is blocked even if no tab is open to YouTube).

I’m not sure what the Qt version has anything to do with this - if it’s about the multiple “Firefox instances” listed in the block list - that’s great, but solving that won’t help with Firefox spamming the sleep blocking.

also with YouTube

You’re right. Now I tried to quickly browse “short” YT videos and the same bug appeared.

It seems that any site with a lot of autoplay videos (in Firefox) will cause this bug.

I’m not sure what the Qt version has anything to do with this

I’m also not sure if the Qt version has anything to do with the new “Power Management” in Plasma 6.2. :man_shrugging: I didn’t get this bug before Plasma 6.2.

Or is it a bug in the new version of Firefox? :man_shrugging: My version is FF 131.0.3

Latest should be Firefox 132.0 Released October 29, 2024

No issue on Youtube here and I use that all day long with almost all 3rd Party/Privacy Firefox plugins disabled because I have a Premium account,
On Twitter on the other hand I “follow” only a few people not very regularly, without a account, just loosely by bookmarks but with the whole Adblock, Ghostery, Privacy… plugins turned on.

I have now updated to FF 132.0. The bug still appears.

1.) For a few seconds I was surfing in an anonymous window on https://x.com/XCreators. I was not logged in.
2.) Then I closed the anonymous window.

Result: 13 blocked. :slightly_frowning_face:

I think it is a bug in Firefox. After not being able to get rid of the Firefox sleep blockers for days, regardless of what tabs I closed and opened, I restarted Firefox - and now it behaves: blockers are removed as soon as I close the tab with the video playing.

There might be the issue that Twitter has autoplaying videos that cause Firefox to ask for sleep blocking, and if you have a tab that is showing a Twitter feed - you’d like just get new messages with auto playing videos pushed to you when you aren’t even looking at that - causing Firefox to start blocking sleep in a way that doesn’t make sense. But that is still a Firefox problem.

I’ve looked at it a bit more - Firefox has two features to control “wakelock” (sleep inhibition), configurable from about:config, both enabled by default in current versions:

  • media.video-wakelock - Firefox will inhibit sleep when a video is playing, supposedly in a foreground tab but possible also in the background, at least if it has audio (See this bug report on the Firefox tracker)
  • dom.screenwakelock.enabled - This controls the Screen Wake Lock API that allows web sites to request to block sleep.

On my Firefox 131, they are both enabled by default, the Wake Lock API has been on by default since version 126 released on May 2024. If the Firefox being annoying behavior is new as of then - its quite possible that the lock issue is due to a web site abusing the Wake Lock API. You can try to disable that API in your Firefox and see if that improves things.

I restarted Firefox

Yes, restarting Firefox will remove blockers, but watching videos on Twitter will again block sleep. Closing the tab doesn’t remove my blockers.

media.video-wakelock > false

It works, but it’s a temporary workaround. When playing YT videos, I have to use the “manually block” button to keep the monitor on.

dom.screenwakelock.enabled > false

It has no effect.

Ok, so it is definitely an issue with video playing and not the Wake Lock DOM API. This cements the fact that it’s a Firefox bug. You should report it to Mozilla.