Writing a timelapse app for Firefox OS

180 views Asked by At

As I am interested in photography, I thought that it would be nice to have a timelapse capable camera app for Firefox OS. I started to do a bit of research, but all I found was that I need a certified app to use the camera without user interaction. (via the Camera API)

At this point I started to look for a way to enable custom certified apps by somehow even tricking the OS or I don't know. When I couldn't find any way I could do this on an actual phone (some people were able to achieve this in some specific simulator versions, but that makes no sense in the case of a camera based app) I even started to think about modifying the built in camera application, but I think it would require recompiling the whole OS.

(I downloaded the GAIA source from github, and tried to install a slightly modified version of the camera app to the phone, but although it started up, there was a blank space in the place off the live view and it did not work at all.)

I would really appreciate any working methods to achieve this, or even some ideas on what I could try.

I would also welcome any guides telling me how could I do this with GAIA.

Thanks in advance!

3

There are 3 answers

0
gasolin On BEST ANSWER

WebRTC(getUserMedia) audio is landed in 1.2 but getUserMedia video will be supportted in Firefox 1.4.

For this kind of App you should try webRTC (more specific: getUserMedia) from now, which can be test on Desktop browser or Firefox for Android.

So once the platform support the standard, your app could run without any problem.

2
fharper On

As far as I know there is no way to achieve this for now if the goal is to publish your application to the marketplace so that consumers can use it. As you noticed, the Camera API is only for certified app: there is no way to have that level if you aren't an OEM or carrier. The only option, for now, is to use the pick Web Activities for the camera, but it needs users' input, so not useful for a timelapse application. The only thing you could do right now is to use the Web Activity, have an user take the picture itself, and create a video out of it, but it will be a manual process for the picture taking part. Keep an eye on the Camera API, as no permission level is set in stone, it may change in the future.

The only way to use certified API is to build your own B2G, and add your certified app to it, but it's not a solution to deploy an application.

0
Isti115 On

I have successfully done it by setting

user_pref("devtools.debugger.forbid-certified-apps", false);

in the B2G prefs.js, and then from the app manager debugging the camera app and running this:

setInterval(function(){document.getElementById('capture-button').click();}, 5000);

I know this is a very bad solution, but it's working, and I mainly did that to prove myself that something like this is possible. :)

ps.: you can unplug the phone and it will still take a picture every 5 seconds :)