10-13-2012 01:06 PM
My app needs the display to NOT go idle in certain cases. I've been able to do this in Cascades and on iOS but I still can't do it in a WebWorks app for PlayBook. I know there was a plugin for this that was deemed broken. Did this ever get fixed? My app would be a LOT better with the display not idling out after a certain amount of time.
10-13-2012 04:48 PM
The following code should work for the Playbook to ensure that the screen stays awake at all times:
<div style="z-index:-1; width:0px; height: 0px; overflow:hidden"> <object data="/assets/videos/awake2.swf" type="application/x-shockwave-flash"> <param name="movie" value="/assets/videos/keepAwake.swf"> <param name="play" value="true"> <param name="loop" value="true"> </object> </div>
This is definitely a hack, but it was the only way I was able to get it to work. Looping an HTML5 audio or video file does keep the device awake too, but unfortunately tends to interfere with background audio/video and forces the title of the playing track to be displayed in the status bar.
Let me know if there are any issues.
10-14-2012 12:14 AM
Wow this is a great idea, thanks!
You could actually make it possible to turn it on and off by creating a function that dynamically inserts / removes the html you posted. I'm going to try that!
10-15-2012 07:01 AM
It seems to be coming to webworks though.
10-15-2012 02:04 PM
If you want to let users control whether the application goes to sleep or not, you can just swap the display of the videoLoop div (posted above) between 'block' and 'none'.
// use system sleep defaults document.getElementById('videoLoop').style.display = 'none'; // keep screen awake document.getElementById('videoLoop').style.display = 'block';