[Superpost] Possible to keep screen active / screen on?

Yes, I included the html file and the js in the asset. I only tested for Android so far… Will test with iOS tonight. Thanks again for this NoSleep method!

2 Likes

Ok, so It’s still not working perfectly… including html file and js file in asset stopped working and when I tried to reproduce the result, clicking the Advance options tab of the webviewer would cause browser to refresh. So I tried including the Script in the header of the html file… and it works great! But not for all android devices. Some would give this error in the webviewer window: Domain: undefined Error Code: -1

What is this? Do you know what I can do about it?? Thanks for your help again.

Hey,

Yeah - this is what I meant that there are known issues in Thunkable X with offline html on Android :grimacing: Maybe try uploading it to a webspace until Thunkable hopefully fixes those errors :grimacing:

Best, Chris

1 Like

Ok, will do as you suggest. Thank you! Yes, I can’t wait for Thunkable make offline html smooth.

1 Like

I created an html file with the NoSleep.js script in the header and hosted it at: https://hencehuman.github.io/index.html

In the webviewer, I just use that address and it works fine now. It requires the device be connected to the internet while loading up is all…

3 Likes

Does the user have to click enable for the nosleep.js script to work… Is there a way where it make it enabled without clicking the button? I want to run this in the background without having the user click a button to keep their screen on…

I am wondering about this too. Do you keep visible the portion of the webviewer where the button is, or does this somehow start on it’s own on the page load?

@hhuman @Chris

Yes, but only for some android devices though. Check this out: Keep screen alive and / by user interaction

1 Like

I made a small window using a row with a webviewer that once they click the enable button, they can click an x in the top right corner to hide the row.

2 Likes

Thank you for such a quick reply!!!

2 Likes

You’re welcome. Thank you for kind acknowledgment!

1 Like

Hi guys. I made a simple app with the video player and uploaded a 1 minute video to it. I have my screen timeout set to 30 seconds for testing. The screen times out at 30 seconds when the video is playing. Unless i expand it to fullscreen mode. Is this the way it is? Should not the screen stay on when a video is playing regardless? Thanks for your help!

What is the time to fall asleep is installed on your phone?

1 Like

Hi actech. I understand you would like to help me solve this problem or else you would not have replied. The thing about the time to fall asleep is not the concern here. I need my app to keep the phone screen on for as long as it is running. Hours. Unless you can help me to have it running while the screen is off as well which would be ideal. Without these two functions, we are being very limited by what we could build on cross platform. From what I am seeing, this community will be full of joy once we have this possible. Thank you for your attention.

I’ll check out your situation on my phone, and later write the answer.

1 Like

See my link project. You screen dims after 30 seconds and everything is working fine?

https://x.thunkable.com/projects/5dbac4cf1f0c0a55589b0693/project/properties/designer/

1 Like

To play a video I like WebViewer component. Why? The answer to this question can be found here.

https://x.thunkable.com/projects/5dbac6e5228d17061fdb13f5/project/properties/designer/

1 Like

Actech, thank you for replying again. The first link you sent with just the video player alone and nothing else on the screen plays as long as your eyes are facing the screen because of the Smart Stay feature. When you look away, even if the the video is still playing, the screen dims after 30 seconds, turns off after a second and the video stops as well.

The webviewer ones does keep the screen on, however can it play offline media asset? And can it autoplay?

This is the deal: I’m using a looping blank white video to keep the application running because I don’t know how else to do so. To bypass the screen timeout when the app is running is what I need.

To have the app running in the background is what I really, really need.

Is there an html5 script that we can use in webviewer to allow this?

Thank you for your expertise in helping me.

On my phone does not have Smart Stay, but the settings in my sleep mode set at 30 minutes. With these points my screen does not turn off and everything is fine.

With Web Viewer I also do not have problems. I can watch streaming video or normal video and the screen does not turn off.

You can use HTML5, but beautiful solutions do not work.

Of course if you have sleep mode at 30 mins, the screen will stay on for 30 mins, right?

How do we expect the users of our app to adjust their screen timeout to 30 miutes as well? I believe we can serve our people better than that.