You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/12/05 01:56:03 UTC
[8/9] git commit: fix camera for firefox os
fix camera for firefox os
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/3424ddb3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/3424ddb3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/3424ddb3
Branch: refs/heads/master
Commit: 3424ddb39c25d28ccb976a817b7af9d371381447
Parents: e8e4208
Author: James Long <lo...@gmail.com>
Authored: Tue Oct 29 15:40:18 2013 -0400
Committer: hermwong <he...@gmail.com>
Committed: Tue Dec 3 13:10:25 2013 -0800
----------------------------------------------------------------------
src/firefoxos/CameraProxy.js | 49 +++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/3424ddb3/src/firefoxos/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/CameraProxy.js b/src/firefoxos/CameraProxy.js
index bbed304..9afb343 100644
--- a/src/firefoxos/CameraProxy.js
+++ b/src/firefoxos/CameraProxy.js
@@ -17,36 +17,35 @@
* specific language governing permissions and limitations
* under the License.
*
-*/
+ */
+function takePicture(success, error, opts) {
+ var pick = new MozActivity({
+ name: "pick",
+ data: {
+ type: ["image/*"]
+ }
+ });
+ pick.onerror = error || function() {};
-function getPicture(cameraSuccess, cameraError, cameraOptions) {
- cameraError = cameraError || function(){};
- var pick = new MozActivity({
- name: "pick",
- data: {
- type: ["image/png", "image/jpg", "image/jpeg"]
- }
- });
- pick.onerror = cameraError;
- pick.onsuccess = function() {
- // image is returned as Blob in this.result.blob
- // we need to call cameraSuccess with url or base64 encoded image
- if (cameraOptions && cameraOptions.destinationType == 0) {
- // TODO: base64
- return;
- }
- if (!cameraOptions || !cameraOptions.destinationType || cameraOptions.destinationType > 0) {
- // url
- return cameraSuccess(window.URL.createObjectURL(this.result.blob));
- }
- };
+ pick.onsuccess = function() {
+ // image is returned as Blob in this.result.blob
+ // we need to call success with url or base64 encoded image
+ if (opts && opts.destinationType == 0) {
+ // TODO: base64
+ return;
+ }
+ if (!opts || !opts.destinationType || opts.destinationType > 0) {
+ // url
+ return success(window.URL.createObjectURL(this.result.blob));
+ }
+ };
}
module.exports = {
- getPicture: getPicture,
- cleanup: function(){}
+ takePicture: takePicture,
+ cleanup: function(){}
};
-require("cordova/firefoxos/commandProxy").add("Camera", module.exports);
\ No newline at end of file
+require("cordova/firefoxos/commandProxy").add("Camera", module.exports);