Web interface: prevent screen saver from activating #99436
Labels
No Label
Good First Issue
Priority
High
Priority
Low
Priority
Normal
Status
Archived
Status
Confirmed
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Job Type
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: studio/flamenco#99436
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The web interface should (optionally?) prevent screensavers from activating.
This is most relevant for the Last Rendered view, for displaying in a central location in an animation studio.
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @dr.sybren
Hello, could you tell me exactly what you expect from the changes to the web interface.
Thanks in advance
The goal of this task is to make it possible for a computer to show the Flamenco dashboard, without any further supervision. It would be great if Flamenco itself had a way to keep the screensaver from activating. Not sure if this is even possible, though.
I did some research and it looks like there are a couple ways to fix this:
Using Screen Wake Lock API, as it supports all major browsers, except Firefox.
Playing an invisible video on loop --- not pretty hack for Firefox, otherwise setting the flag
dom.screenwakelock.enabled
totrue
.Alternatively, we can achieve the best of both worlds with NoSleep.js as it has a fallback with the second option for browsers that don't support the API yet. See the demo.
The Screen Wake Lock API is not available, unfortunately. From MDN:
This means that it's only functional when Flamenco is running behind a TLS connection. As Flamenco is designed to run on-premise, by not-too-technical people, it's unlikely that this will be the case.
So I guess playing a video is the only option here.
When reading more about Secure contexts I was glad that it considered locally deployed pages as secure.
And then disappointed because it only considers those from "localhost" not the ones under a local IP address such as 192.168.0.16
About the playing video option, I developed a tiny proof of concept using Vue and some other libs that our webapp uses too such as pinia for state management. I have tested and it seems to be working as expected in both Chromium based browsers and Firefox.
Nice!
Do you know how dependent this is on things like the video size, presence of an audio track, whether the video is actually visible (or hidden via CSS), etc?
I've used FFmpeg to turn your
one-second-video.mp4
into a 16x16 pixelone-second-video.webm
. This not just reduces the screen size, but also turns your huge monstrosity (15 kB) into something slightly more manageable (2 kB) 😸The reason I ask is that I would suspect there's limits to this, where browsers have a different interpretation of what the user is doing with the video, from "watching a video" to "some advertisement in a corner".
Hi @dr.sybren I did a few more tests.
Your 16x16 webm version worked, so I went further and set the
<video width="1" height="1" />
and it also worked. Apparently the browser doesn't care a lot about the video size (which is a bit weird how a 1px can wake lock your computer 😄)So far on tests it worked with the muted audio track of the video, not sure if it even has an audio track, if one is present it should be muted because of autoplay. If for any reason autoplay doesn't work then some awful JS glue would be required to play on the toggle switch.
After doing some extreme tests such as 1px video with absolute position at -500px I decided to completely hide it already simply with
display: none
and surprisingly it also worked 😆I have updated the POC repo with the changes and made it more convenient for you to try it out by publishing to gh pages. Check out the live version.
👍
ffprobe
is your friend:I think that's a good idea to do anyway, because my browser (Firefox) by default disallows any auto-play. Unless explicitly allowed for that website, of course. This may also be an issue if we want the webapp to remember whether it was wakelocked or not.
Woah!
Which browser & OS did you test with?
I'll give it a try when I have the time to let my computer sit still ;-)
Thanks for the ffprobe tip! 👍
I tried to set my Firefox on Windows to deny autoplay but the poc website worked anyway. It did not seem to respect my setting. I'll be trying some js glue for events where autoplay will not work, so far it's being too magical for me, I'm suspicious of why this is working.
Previously tested in firefox and brave (both snaps) on ubuntu, and chrome, edge and firefox on windows.