I want to work with camera api in firefox os simulator. Docs suggests that it is only available for certified apps. If i want to take picture using camera in my app, how can i proceed developing the app?? Thanks in advance
You have to use the Web Activities API to take pictures. Simply put, it's the equivalent of Android's Intents
for the Open Web.
I'd write a lot about it, but there are good code examples out there, like this one, implementing just that. You have to a few stuff:
Create a Web Activity:
var recordActivity = new MozActivity({ name: "record" });
Set a onsuccess
callback, and do whatever you want with the result on it:
recordActivity.onsuccess = function () { console.log(this); }
There are a few more details, and all of them are listed on this post on Hacks.
So some stuff changed in the past year. Web Activities are still the way to go for most apps, but we have two APIs that were previously not exposed.
From Firefox OS 1.4 you have access to getUserMedia so you can get a direct camera stream. From Firefox OS 2.0 you now have access to the mozCameras API that allows for stuff like camera switching and control of the flash.
© 2022 - 2024 — McMap. All rights reserved.