richtr / nosleep.js Goto Github PK
View Code? Open in Web Editor NEWPrevent display sleep and enable wake lock in any Android or iOS web browser.
License: MIT License
Prevent display sleep and enable wake lock in any Android or iOS web browser.
License: MIT License
tried the test page and a custom webpage (both works instead in IOS5).
The current implementation of NoSleep.js on iOS makes a redirect request and immediately cancels it, which resets the sleep timeout and therefore prevents the device from sleeping.
However, the window.stop()
call actually cancels all pending requests, with a 0
status code. That means your application will "randomly" fail requests, like the connection was lost, but without any log of any kind.
This has been excruciatingly painful to debug (we were a whole team of people trying to diagnose networking issues and XmlHttpRequest
constructs for two days), and obviously won't happen while you develop (unless it happens that your request was "in progress" when the stop
call was made).
I think this library, even though very useful by itself, can cause serious damage if used unknowingly by misinformed developers.
I suggest these changes:
enable()
, display a console.warn
(fallback to console.log
) saying that requests may be cancelled while nosleep
is enabled. This will allow developers to see what caused any failed requests following that message.NoSleep.js
cannot be used to keep a device awake while uploading large files.Sadly, many production applications do not have active logging, and it's very easy to blame the wifi on an iPad (that's what we initially thought), therefore I would not underestimate the gravity of this issue.
HI i'm use NoSleep.js with CRA
When CRA build it throw following error
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify
I'm solve this build warnning now import dist/NoSleep.js
file
import NoSleep from 'nosleep.js/dist/NoSleep';
So I think main entry point use CommonJS and ES module entry point with the module field
package.json
{
...
- "main": "src/index.js",
+ "main": "dist/NoSleep.js",
+ "module": "src/index.js",
...
}
Hi,
Since the recent addition of webm file, NoSleep is no longer working on my Android phone with Firefox. Tested and confirmed with the examples.
Webm video should play back and NoSleep should work.
Webm video is considered somehow invalid by Firefox for Android and not played back. MP4 file is working fine. If I use a WebM-encoded version of the MP4 file (encoding done with default "webm" profile in VLC), it works.
It seems to be working fine in Chrome/Chromium for Android though.
Best,
Hello,
I need to prevent sleep in desktop browsers too. Is there a reason why you did not target that? Do you care for a pull request? Thanks
I assume the video that's playing in the background [to keep the browser awake] is of very low quality to keep bandwidth usage low, can you please confirm how much bandwidth is used over the course of 1 minute? Also, is the video just "black" in that there or no images that might be seen by anyone if someone digs into the data? Lastly, how long is the video?
I'm trying to implement this to prevent the screen locking while my users wait for files to upload.
I can't get it to work consistently in my web app yet the demo page works perfectly on the same test device (iPhone X).
Could it be something to do with the fact that my web app is accessing the users' photos and videos after NoSleep is enabled? I'm enabling on the 'Choose File' button press then disabling when the upload is complete.
I should also maybe mention I"m using the Uploadcare widget for picking files.
Any ideas? 🤔
Documentation Is:
When you use NoSleep like demonstrated in the Live Demo, where you initialise the NoSleep
object via new NoSleep()
during page load, and only .enable()
it when tapping the button, it won’t activate as expected, if the page was hidden after initial load and before enabling NoSleep.
Here’s how you should be able to reproduce this:
I experience this on my iOS 12.1 devices. Haven’t tested on Android.
Not sure. Maybe this is even intended or preferred behaviour for the demo. But for me it was a bit of a head-scratcher debugging this.
So it might be relevant to amend the example code to avoid this behaviour. Here’s a quick example of what works (this is the JS from the example):
var noSleep = null; // DON’T DEFINE IT HERE
var wakeLockEnabled = false;
var toggleEl = document.querySelector("#toggle");
toggleEl.addEventListener('click', function() {
if (!wakeLockEnabled) {
noSleep = new NoSleep(); // DEFINE IT HERE
noSleep.enable(); // keep the screen on!
wakeLockEnabled = true;
toggleEl.value = "Wake Lock is enabled";
document.body.style.backgroundColor = "green";
} else {
noSleep.disable(); // let the screen turn off.
noSleep = null // DELETING REFERENCE AGAIN
wakeLockEnabled = false;
toggleEl.value = "Wake Lock is disabled";
document.body.style.backgroundColor = "";
}
}, false);
Alternatively, it might be more suitable to amend the constructor and the enable()
method, so that you could use the example code as is (and avoid creating and destroying a NoSleep object on each run) and still avoiding this “issue”.
OS: Android 5.0/Windows Phone 10
Browser: WebView/Edge
This is just only cheat.
Don't working at all.
very cheater.
get lost.
Steps to reproduce
I have a wep page that, on the press of a button, enables noSleep and starts recording the microphone using Chrome's speech recognition API.
If I remove all speech recognition code, noSleep works. But if I enable it, the screen eventually locks. Is there a workaround?
Thanks in advance!
The runtime breaks in NoSleep.js line 47 9 undefined. Reason is that IE cannot handle relational location updates as in line 47 "window.location.href = '/'". This seems to be a known issue http://stackoverflow.com/questions/10201809/ie-incompatability-with-window-location-href
I have two questions:
I just wrote a web app that requires the screen to turn on. This library does work nicely while the page is displayed in safari, but when I add it to the home screen and launch it from there, it won't prevent the device from entering sleep mode.
This does not seem to work when you start your webpage from a QR reader like the one from Scan, which I understand is the most popular one for iOS. I tried this e.g. on iPhone 6 with iOS9.2.
The reason seems to be that this mobile QR app uses its own browser, which behaves differently.
Any ideas?
Webkit 533
I know it (must be wrapped in a user input event handler e.g. a mouse or touch handler) in order to make the playvideo works.
It works when I use finger manually click the button , but when I use jquery to auto trigger the button then the play video does not work.
And i also find out that, after i use finger click it then I implement timer to click it repeatedly with 5 sec. it works also.
But what I want is the button was hidden in display and then trigger the nosleep at background.
I test in Iphone X.
Anyone know any solution to achieve that?
We don't use es6 in our frontend. Therefore our webpack build crashed while trying to build and minify with UglifyJS. This is easily fixed when pointing towards the minified file in your dist folder.
NoSleep with the latest safari is redirecting to root of the website when the screen is off.
Problem is the window.location.href = "/" in the enable() function code for iOS
Solution appears to be in the code used for the demo, which instead uses window.location = window.location
This message I receive on Android Chrome while do
NoSleep.enable()
And NoSleep does not work
Hi!
I did some tests on Android and iOS using Google Chrome 51 on both of them.
On Android works like a charm! But on iOS didn't work.
So I made some tests using Safari and the plugin works!
I did some research but I didn't succeed.
Someone had this problem too?
Thanks!
I noticed that music from Spotify would get quieter when I opened a page with NoSleep. Even if no music was playing there would always be a hiss in my Bluetooth headphones which means NoSleep was keeping a "wakelock" on them too.
I tried setting mute to true and volume to 0 (#45) but neither worked. Completely removing the audio track did work and the wakelock is still acquired on Chrome on Android. Do other browsers require the audio track?
Here's the video I used:
data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAABpBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc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AQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAPAAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAABRzdGNvAAAAAAAAAAEAAAAwAAAAYXVkdGEAAABZbWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAsaWxzdAAAACSpdG9vAAAAHGRhdGEAAAABAAAAAExhdmY1OC4zLjEwMA==
Just tried this in a mobile app I built. The code I used is:
noSleep = new NoSleep();
function enableNoSleep() {
noSleep.enable();
document.removeEventListener('touchstart', enableNoSleep, false);
}
document.addEventListener('touchstart', enableNoSleep, false);
Did nothing to stop the screen from going to sleep.
hey guys, i am very like your library, but on some device i found that when i tried enable nosleep it open native browser and preverent work of site. Did you have same bug, and do you know how we can fix it?
Thanks for this project! However, I have encountered this issue.
The demo page works fine on Android. And porting the code into my app with the button to enable noSleep also works. However, enabling noSleep via Javascript code that does not originate from a button click does not work. In my case I want the page to start with noSleep enabled.
I went so far as to include the button and use $('#toggle').click()
to click it programatically seconds after the page was loaded. But still doesn't work. I printed noSleep.noSleepVideo.paused
and found that the video was remaining paused despite the play() execution. I have come to the conclusion that Android inhibits the playing of video without user interaction. I suspect it is related to the same reason that autoplay is disabled:
https://www.aerserv.com/why-does-video-autoplay-on-mobile-devices-not-work/
It work great for older Android OS and somewhat somehow Google Nougat force refresh in 20 mins. I turn off the battery optimization and keep stay on with no luck and still hard refreshed the page automatically after 20 mins. The same page on older Android works great as well as iOS iPhone6 and iPhone7. Please help with S8+ Samsung Chrome browser.
Hi,
When running a webpage using NoSleep in the latest Chromium build for Android, I get a
DOMException: Failed to load because no supported source was found.
Which is never caught. I tracked it down to https://github.com/richtr/NoSleep.js/blob/master/src/index.js#L37 where it should be caught on play
. I guess actually the enable
method might return the play
Promise so that user can deal with issue the way they want, no?
For the deeper underneath issue raising this exception, it seems Chromium on Android has no support for MP4 video files (not sure whether Chrome does). Replacing https://github.com/richtr/NoSleep.js/blob/master/src/media.js by a WebM converted video works well!
Maybe NoSleep could provide the source file in both MP4 and WebM and let the browser play the best fitted one?
Thanks!
Steps to reproduce
Worked for same version of Chrome on Android 4.4.4 and Safari on iOS 8.3;
I can't seem to get it working under iOS 11. Does anyone have the same issue?
Hi I tried this on Android Lollipop and Chrome and it does not work...
I tried the example and a custom app using NoSleep.js....
any advice?
Documentation Is:
Howdy! I think NoSleep.js doesn't work with with a jQuery click event when a handler reference is used rather than an anonymous function (I hope I got those terms right :-P ).
E.g.
Doesn't work (NoSleep.enable() is in the start_ex_wizard function)
$('#start-link').click(start_ex_wizard);
Does work
$('#start-link').click(function(){
NoSleep.enable(); // Prevent device from sleeping
start_ex_wizard();
});
I thought you might like to add a note to the readme.md so others are aware. Alternatively I could document it on StackOverflow.
Anyone notice this?
Anyone noticed similar results? Does not seem to work on 10.2 period.
Tested this using the live demo before implementation on our site and it is not working.
I tested the script yesterday, seemed to be working perfectly. After updating to iOS 10.3 it stopped working. Hope you can find a fix for this.
It's working on iOS's Safari - but on Android Chrome, it's not working?
Anyone else having this issue?
[Edit]
It works on Android's Firefox.
On Chrome, I get a Javascript-Error.
The console says:
NoSleep.min.js:2 Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.
and:
NoSleep.min.js:2 Uncaught (in promise) DOMException: play() can only be initiated by a user gesture.
[Edit 2]
I fixed the issue by calling nosleep.noSleepVideo.play(); directly from a click-Event ($('.el').on('click', function(e){ nosleep.noSleepVideo.play(); });
this of course doesn't work on older iOS devices as the code intends to do...
Do not use excessive CPU
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.
I used the live example page
Go to the live demo page and enable wake lock, press Shift+Esc and see the CPU usage shooting up.
Tried this on iOS 11.3 WebApp (safari under the hood). It "works" in so far as it does not sleep but it pops up a blank square on a black background covering the WebApp which I am guessing is the video. Tried basic things like hidden:true and display:none without success. If I home and return it goes away and the app is still humming along. Used same JS on android WebApp and all good so high degree of confidence that implementation is correct.
I haven't looked under Android or IOS but under OSX, if I change the UA to android, enabling NoSleep uses tons of CPU by coreaudiod and also the browser. At a wild guess it is playing the media file and this is chewing up CPU.
Perhaps this should be noted in the README, as having a no-sleep solution that doesn't use CPU may be desirable (it is for me).
Is it (or could it be) possible to store the state of the nosleep in a cookie, so that the setting is persistent even if the user refreshes the browser window?
I have a web application where the user is monitoring an output of Wordpress posts, and I have a javascript snippet that is reloading the page every 60 seconds to retrieve any new posts. If the user enables the wake lock, but the page then reloads itself, it turns off the wake lock. I was thinking if the state of the wake lock could be bound to a cookie, then when the page reloads the page the script could check the status of the cookie and decide if the wake lock should be enabled or disabled upon page reload. Is this possible?
I was wondering if placing a HTML5 VIDEO tag in my HTML-page will have the save effect as embedding 'nosleep.js', I've encoded few 'blank videos' with FFMPEG and I was going to test it..
I was just curious on how it works, and why there is a jump in playing time on MP4 and for WEBM the 'loop' attribute is enough..
would this thing work in the same manner? (after manually clicking play):
<video autoplay="true" crossorigin="anonymous" loop="true" muted="true" preload="auto" playsinline="true" poster="poster.jpg">
<source src="video_h264.mp4" type='video/mp4; codecs="avc1.42001E"' />
<source src="video_vp9.webm" type='video/webm; codecs="vp9.0"' />
<source src="video_vp8.webm" type='video/webm; codecs="vp8.0"' />
<source src="video_theora.ogv" type='video/ogg; codecs="theora"' />
<source src="video_mpeg4.avi" type='video/avi; codecs="mpeg4"' />
<p>No Support For HTML5's-video.</p>
</video>
Hey there,
I did an install using bower and it looks like my local version of NoSleep.js doesn't have the most recent commit. My local version has window.location = window.location;
instead of window.location.href = '/';
, which results in the library not working on iOS (9.3.1). Could it be that the library version number needs to be incremented?
Great work otherwise!
-Brian
it was not working for the web app i'm designing, so in an attempt to problem solve I cloned the example site, and added :
<meta name="apple-mobile-web-app-capable" content="yes">
I opened the site on device with ios 9, saved it to home screen, opened it, clicked the button, and device went to sleep after standard time. (same behaviour on android)
Currently for iOS the location reload employs window.location.href = '/'
. But the problem is that if the phone is turned off, then the page is changed to /
when it reawakened.
Alternatively if reload employs window.location.href = window.location.href
, the page will remain unchanged after phone sleep. (Although it will be reloaded.) This still works to keep the phone awake.
When NoSleep detects oldIOS it seems to redirect users to the root path when the timeout hits.
Found this in chrome when using browser to emulate an iPhone 5. Not sure if it affects actual devices.
Dug around a bit and the problem seems to be here
if (oldIOS) {
this.disable()
this.noSleepTimer = window.setInterval(function () {
window.location.href = '/'
window.setTimeout(window.stop, 0)
}, 15000)
}
The behaviour is pretty bad. Basically a user is randomly kicked off whatever page theyre on back to the root domain after 15 seconds.
In addition to playing videos, while playing HTML5 games, I also want to prevent mobile phone screen sleep.
Starting nosleep js seems to drain my batterie and heats the phone.
Is there any nice tool to test that on android phone? Any hints how to avoid it?
On Android UC Browser if you enable noSleep AND webkitRequestFullScreen it will show you a fullscreen video player. Is there a workaround for this?
I would consider not doing the document.href request if document.hidden is true. Otherwise stopping the request does not seem to work.
Steps to reproduce
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.