Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Backlight timeout / sleep mode disable for foreground app in BB10 #331

Closed
edyb opened this issue Oct 26, 2012 · 3 comments
Closed

Backlight timeout / sleep mode disable for foreground app in BB10 #331

edyb opened this issue Oct 26, 2012 · 3 comments

Comments

@edyb
Copy link

edyb commented Oct 26, 2012

Hi folks,

I made a Webworks app for Playbook and managed to disable standby / sleep-mode when my app is in foreground using the "nosleep.js" extension for Webworks Playbook, and also with a HACK that was found..... when playing an empty/hidden video element with autoplay, Playbook will not go into standby.

I have not had any success getting this to work on my BB10 Dev Alpha. The rest of my app is ok, but I can't get it to keep the backlight on and stay "Awake" when my app is in the foreground. I also tried playing a video using the following code:

div id="video" style="margin:15px 15px; position:absolute; left:0; top:0;"
video id="movie" width="10" height="10" autoplay="autoplay" preload="metadata" poster="disable_standby.jpg"
source src="disable_standby.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
/video
/div

Anyways, it does not disable the standby like it does on the Playbook.

Any ideas on how to get a foreground webworks app on BB10 to keep running indefinitely?

Sincerely,
Edy

@edyb
Copy link
Author

edyb commented Oct 28, 2012

Ok, I figured it out. The video play hack still works just like on the Playbook. It needs to be running on the main index.html file. I made it a hidden div. The exact code is:

div style="display:none;"

video id="movie" width="10" height="10" autoplay="autoplay" loop="loop" preload="metadata" poster="disable_standby.jpg"

source src="disable_standby.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'

/video
/div

Then whenever you are using other sound or video in your app, you need to run this movie again and continuously run it for the duration of your app running as follows:

document.getElementById('movie').play()

Other features available for BB10 to enable the app to also run in the background:

rim:permissions
rim:permit
run_when_backgrounded
/rim:permit
/rim:permissions

Sorry I haven't figure out how to markup my code in Github with the "<" and ">" symbols, so I left them out above.

@edyb
Copy link
Author

edyb commented Nov 30, 2012

UPDATE:

Using the video playback infinite repeat method discussed above (which also works on Playbook), on the previous Dev Alpha OS 10 and webworks 1.0.2.9 the backlight would STAY ON while the app was in the foreground. However, since the update to OS 10.0.9.1103 and webworks 1.0.3.8, the backlight DOES NOT stay on anymore.

I guess RIM patched this work-around? Since my app would always play this video, the video playback icon would show a "Play" triangle icon in the top menu/notification area (like on Playbook) on the Dev Alpha... showing it is constantly playing something. That would be my infinitely repeating HTML5 movie play element, which was nothing more than a blank tiny (like 16x16) MPG movie file of a few frames duration that was hidden in the background so it wouldn't even show.

Now, since the latest OS and webworks recompile and install, it doesn't work! My app was already submitted and working beautifully, now it is broken again.

Does anyone know if this is a bug that will be fixed to allow the work-around to work again, or if there is a plan to eventually provide an API event call to allow us to set the backlight options within our Javascript? I'd like to have a toggle button of some kind in my bbUI.js-based UI menus which lets the user actually choose to set backlight on permanently or use default settings.

For now, my app backlight will go off but I have it running in background so at least notifications and alarms can still work even if not in foreground.

@timwindsor
Copy link
Contributor

Likely that was a lower level change in the Browser or Media player that broke this. Investigation is ongoing for an API in WebWorks to support this. We'll track it in the existing feature request #304 so we don't have a bunch of duplicate issues posted.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants