I have a web app ( using React ), and I want the display to not fall asleep when the user is on my web page. How can i achieve that? I tried running <video autoplay muted loop>
but that did not work out, the video plays but the OS still goes to sleep ( Im using Mac btw ).
I also tried to fetch from a server every 30 seconds but that did not work out too. I also tried with <audio>
but still no success.
I see that YouTube somehow is able to succeed doing that, when I watch a video there even if it is muted my monitor does not go to sleep.
I heard there is some webLock browser api but it is not supported in Firefox and that's a problem for me so I am trying to find another way.
EDIT: I have heard of noSleepJs but I read somewhere that it puts a strain on the battery of the user and could cause also lag, is that correct ?