New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Very high CPU usage on desktop Chrome and Brave browsers #66
Comments
|
It has something to do with the webm file. If I disable that from the video sources, mp4 starts playing and that one uses significantly less cpu (jumping around 10%-20%) . |
|
generated a new webm video as below that consumes only 1-3% CPU. It's slightly bigger in size though: |
|
found a better way, generate a 5sec 1fps webm which doesn't even spike the CPU: The only thing is that the code has to be changed to check the currently playing source when testing for the media to loop |
|
Hey, can you post here the new generated video files? You can use this tool to convert them to data URI: Tks in advance |
|
You can find it here. It required another change in index.js to detect the video (since it's not 1sec anymore). Also I only tested it with Brave and Chrome browsers on desktop and with Android Brave on Pixel 3. |
|
Ok, tks |
|
I created a pull request that will hopefully fix these CPU issues: #65 |
|
I have same problem with Chrome. |
|
just found out this is the problem for my computer to always having it's fans at max. |
|
@pedromarquesm Use NoSleep.js from #65. |
|
last commit on 5 december of 2018. is this repo already dead? |
Thank you. This really makes a difference. It reduced by CPU utilisation from 50% to almost idle. |
how can i use it? |
You need to run the ffmpeg commands on a Linux machine where the tool is available to generate the template video files. Use thee videos in NoSleep.js instead of importing the strings which are present by default. This is my code in a react project. Also don't forget to update the if statement as described in previous post. |
yep,i get it |
|
Man, I thought I was going crazy. I've been trying to profile my reactjs app trying to find the problem. I didn't think it would be caused by this lib. |
well, don't even try to profile it on development mode :) I was getting almost 1gb of memory use (well because of development mode) I also had a similar problem with a particular version of typescript. the filewatcher was very CPU intensive. eventually they solved it |
|
Can't wait to use the latest version of this lib (thx for all the hard work recently @richtr), but unfortunately I'm stuck on v0.8 - if I move to any later release I get this problem of maxed out CPU in Chrome (on Windows). I take it that the video file changed after that release. Does it need something like PR#65 to fix this? (Will post this there too) |
Same here! |
|
[ Quote pmiklos @ CE 2019-02-07 05:55:53 UTC: Also note: theoretically updating the playback position (when done properly) should cause less load than looping the whole video. |
|
什么事吖
|
|
@a22aaass, [1] Due to the extremely close timestamp to my post, and some low-effort background research that happened to have failed. |
Expected Behavior
Do not use excessive CPU
Actual Behavior
The CPU usage goes up to 170-180% (inspecting in Chrome task manager) as soon as the NoSleep enable() function is called and my laptop starts overheating.
I doesn't seem to happen with Firefox and I also tested on Android 9 (Pixel 3) which didn't seem to overheat or use much cpu.
I understand that the primary target of this library is mobile devices, but it still shouldn't behave as described above on desktop.
Code
I used the live example page
How Do We Reproduce?
Go to the live demo page and enable wake lock, press Shift+Esc and see the CPU usage shooting up.
The text was updated successfully, but these errors were encountered: