{
    "version": "0.3.6",
    "name": "org.apache.cordova.camera",
    "cordova_name": "Camera",
    "description": "Cordova Camera Plugin",
    "license": "Apache 2.0",
    "repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git",
    "issue": "https://issues.apache.org/jira/browse/CB/component/12320645",
    "keywords": [
        "cordova",
        "camera"
    ],
    "platforms": [
        "firefoxos",
        "android",
        "amazon-fireos",
        "ubuntu",
        "ios",
        "blackberry10",
        "wp7",
        "wp8",
        "windows8",
        "browser",
        "windows"
    ],
    "engines": [],
    "englishdoc": "<!---\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n\n# org.apache.cordova.camera\n\nThis plugin defines a global `navigator.camera` object, which provides an API for taking pictures and for choosing images from\nthe system's image library.\n\nAlthough the object is attached to the global scoped `navigator`, it is not available until after the `deviceready` event.\n\n    document.addEventListener(\"deviceready\", onDeviceReady, false);\n    function onDeviceReady() {\n        console.log(navigator.camera);\n    }\n\n## Installation\n\n    cordova plugin add org.apache.cordova.camera\n\n## navigator.camera.getPicture\n\nTakes a photo using the camera, or retrieves a photo from the device's\nimage gallery.  The image is passed to the success callback as a\nbase64-encoded `String`, or as the URI for the image file.  The method\nitself returns a `CameraPopoverHandle` object that can be used to\nreposition the file selection popover.\n\n    navigator.camera.getPicture( cameraSuccess, cameraError, cameraOptions );\n\n### Description\n\nThe `camera.getPicture` function opens the device's default camera\napplication that allows users to snap pictures. This behavior occurs\nby default, when `Camera.sourceType` equals\n`Camera.PictureSourceType.CAMERA`.  Once the user snaps the photo, the\ncamera application closes and the application is restored.\n\nIf `Camera.sourceType` is `Camera.PictureSourceType.PHOTOLIBRARY` or\n`Camera.PictureSourceType.SAVEDPHOTOALBUM`, then a dialog displays\nthat allows users to select an existing image.  The\n`camera.getPicture` function returns a `CameraPopoverHandle` object,\nwhich can be used to reposition the image selection dialog, for\nexample, when the device orientation changes.\n\nThe return value is sent to the `cameraSuccess` callback function, in\none of the following formats, depending on the specified\n`cameraOptions`:\n\n- A `String` containing the base64-encoded photo image.\n\n- A `String` representing the image file location on local storage (default).\n\nYou can do whatever you want with the encoded image or URI, for\nexample:\n\n- Render the image in an `<img>` tag, as in the example below\n\n- Save the data locally (`LocalStorage`, [Lawnchair](http://brianleroux.github.com/lawnchair/), etc.)\n\n- Post the data to a remote server\n\n__NOTE__: Photo resolution on newer devices is quite good. Photos\nselected from the device's gallery are not downscaled to a lower\nquality, even if a `quality` parameter is specified.  To avoid common\nmemory problems, set `Camera.destinationType` to `FILE_URI` rather\nthan `DATA_URL`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Browser\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Preferences (iOS)\n\n-  __CameraUsesGeolocation__ (boolean, defaults to false). For capturing JPEGs, set to true to get geolocation data in the EXIF header. This will trigger a request for geolocation permissions if set to true.\n\n        <preference name=\"CameraUsesGeolocation\" value=\"false\" />\n\n\n### Amazon Fire OS Quirks\n\nAmazon Fire OS uses intents to launch the camera activity on the device to capture\nimages, and on phones with low memory, the Cordova activity may be killed.  In this\nscenario, the image may not appear when the cordova activity is restored.\n\n### Android Quirks\n\nAndroid uses intents to launch the camera activity on the device to capture\nimages, and on phones with low memory, the Cordova activity may be killed.  In this\nscenario, the image may not appear when the Cordova activity is restored.\n\n### Browser Quirks\n\nCan only return photos as base64-encoded image.\n\n### Firefox OS Quirks\n\nCamera plugin is currently implemented using [Web Activities](https://hacks.mozilla.org/2013/01/introducing-web-activities/). \n\n### iOS Quirks\n\nIncluding a JavaScript `alert()` in either of the callback functions\ncan cause problems.  Wrap the alert within a `setTimeout()` to allow\nthe iOS image picker or popover to fully close before the alert\ndisplays:\n\n    setTimeout(function() {\n        // do your thing here!\n    }, 0);\n\n### Windows Phone 7 Quirks\n\nInvoking the native camera application while the device is connected\nvia Zune does not work, and triggers an error callback.\n\n### Tizen Quirks\n\nTizen only supports a `destinationType` of\n`Camera.DestinationType.FILE_URI` and a `sourceType` of\n`Camera.PictureSourceType.PHOTOLIBRARY`.\n\n### Example\n\nTake a photo and retrieve it as a base64-encoded image:\n\n    navigator.camera.getPicture(onSuccess, onFail, { quality: 50,\n        destinationType: Camera.DestinationType.DATA_URL\n    });\n\n    function onSuccess(imageData) {\n        var image = document.getElementById('myImage');\n        image.src = \"data:image/jpeg;base64,\" + imageData;\n    }\n\n    function onFail(message) {\n        alert('Failed because: ' + message);\n    }\n\nTake a photo and retrieve the image's file location:\n\n    navigator.camera.getPicture(onSuccess, onFail, { quality: 50,\n        destinationType: Camera.DestinationType.FILE_URI });\n\n    function onSuccess(imageURI) {\n        var image = document.getElementById('myImage');\n        image.src = imageURI;\n    }\n\n    function onFail(message) {\n        alert('Failed because: ' + message);\n    }\n\n## CameraOptions\n\nOptional parameters to customize the camera settings.\n\n    { quality : 75,\n      destinationType : Camera.DestinationType.DATA_URL,\n      sourceType : Camera.PictureSourceType.CAMERA,\n      allowEdit : true,\n      encodingType: Camera.EncodingType.JPEG,\n      targetWidth: 100,\n      targetHeight: 100,\n      popoverOptions: CameraPopoverOptions,\n      saveToPhotoAlbum: false };\n\n### Options\n\n- __quality__: Quality of the saved image, expressed as a range of 0-100, where 100 is typically full resolution with no loss from file compression. The default is 50. _(Number)_ (Note that information about the camera's resolution is unavailable.)\n\n- __destinationType__: Choose the format of the return value. The default is FILE_URI. Defined in `navigator.camera.DestinationType` _(Number)_\n\n        Camera.DestinationType = {\n            DATA_URL : 0,      // Return image as base64-encoded string\n            FILE_URI : 1,      // Return image file URI\n            NATIVE_URI : 2     // Return image native URI (e.g., assets-library:// on iOS or content:// on Android)\n        };\n\n- __sourceType__: Set the source of the picture. The default is CAMERA. Defined in `navigator.camera.PictureSourceType` _(Number)_\n\n        Camera.PictureSourceType = {\n            PHOTOLIBRARY : 0,\n            CAMERA : 1,\n            SAVEDPHOTOALBUM : 2\n        };\n\n- __allowEdit__: Allow simple editing of image before selection. _(Boolean)_\n\n- __encodingType__: Choose the  returned image file's encoding. Default is JPEG. Defined in `navigator.camera.EncodingType` _(Number)_\n\n        Camera.EncodingType = {\n            JPEG : 0,               // Return JPEG encoded image\n            PNG : 1                 // Return PNG encoded image\n        };\n\n- __targetWidth__: Width in pixels to scale image. Must be used with __targetHeight__.  Aspect ratio remains constant. _(Number)_\n\n- __targetHeight__: Height in pixels to scale image. Must be used with __targetWidth__. Aspect ratio remains constant. _(Number)_\n\n- __mediaType__: Set the type of media to select from.  Only works when `PictureSourceType` is `PHOTOLIBRARY` or `SAVEDPHOTOALBUM`. Defined in `nagivator.camera.MediaType` _(Number)_\n\n        Camera.MediaType = {\n            PICTURE: 0,    // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType\n            VIDEO: 1,      // allow selection of video only, WILL ALWAYS RETURN FILE_URI\n            ALLMEDIA : 2   // allow selection from all media types\n        };\n\n- __correctOrientation__: Rotate the image to correct for the orientation of the device during capture. _(Boolean)_\n\n- __saveToPhotoAlbum__: Save the image to the photo album on the device after capture. _(Boolean)_\n\n- __popoverOptions__: iOS-only options that specify popover location in iPad.  Defined in `CameraPopoverOptions`.\n\n- __cameraDirection__: Choose the camera to use (front- or back-facing). The default is BACK. Defined in `navigator.camera.Direction` _(Number)_\n\n        Camera.Direction = {\n            BACK : 0,      // Use the back-facing camera\n            FRONT : 1      // Use the front-facing camera\n        };\n\n### Amazon Fire OS Quirks\n\n- Any `cameraDirection` value results in a back-facing photo.\n\n- Ignores the `allowEdit` parameter.\n\n- `Camera.PictureSourceType.PHOTOLIBRARY` and `Camera.PictureSourceType.SAVEDPHOTOALBUM` both display the same photo album.\n\n### Android Quirks\n\n- Any `cameraDirection` value results in a back-facing photo.\n\n- Ignores the `allowEdit` parameter.\n\n- `Camera.PictureSourceType.PHOTOLIBRARY` and `Camera.PictureSourceType.SAVEDPHOTOALBUM` both display the same photo album.\n\n### BlackBerry 10 Quirks\n\n- Ignores the `quality` parameter.\n\n- Ignores the `allowEdit` parameter.\n\n- `Camera.MediaType` is not supported.\n\n- Ignores the `correctOrientation` parameter.\n\n- Ignores the `cameraDirection` parameter.\n\n### Firefox OS Quirks\n\n- Ignores the `quality` parameter.\n\n- `Camera.DestinationType` is ignored and equals `1` (image file URI)\n\n- Ignores the `allowEdit` parameter.\n\n- Ignores the `PictureSourceType` parameter (user chooses it in a dialog window)\n\n- Ignores the `encodingType`\n\n- Ignores the `targetWidth` and `targetHeight`\n\n- `Camera.MediaType` is not supported.\n\n- Ignores the `correctOrientation` parameter.\n\n- Ignores the `cameraDirection` parameter.\n\n### iOS Quirks\n\n- Set `quality` below 50 to avoid memory errors on some devices.\n\n- When using `destinationType.FILE_URI`, photos are saved in the application's temporary directory. The contents of the application's temporary directory is deleted when the application ends.\n\n### Tizen Quirks\n\n- options not supported\n\n- always returns a FILE URI\n\n### Windows Phone 7 and 8 Quirks\n\n- Ignores the `allowEdit` parameter.\n\n- Ignores the `correctOrientation` parameter.\n\n- Ignores the `cameraDirection` parameter.\n\n- Ignores the `saveToPhotoAlbum` parameter.  IMPORTANT: All images taken with the wp7/8 cordova camera API are always copied to the phone's camera roll.  Depending on the user's settings, this could also mean the image is auto-uploaded to their OneDrive.  This could potentially mean the image is available to a wider audience than your app intended.  If this a blocker for your application, you will need to implement the CameraCaptureTask as documented on msdn : [http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394006.aspx](http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394006.aspx)\nYou may also comment or up-vote the related issue in the [issue tracker](https://issues.apache.org/jira/browse/CB-2083)\n\n- Ignores the `mediaType` property of `cameraOptions` as the Windows Phone SDK does not provide a way to choose videos from PHOTOLIBRARY.\n\n\n## CameraError\n\nonError callback function that provides an error message.\n\n    function(message) {\n        // Show a helpful message\n    }\n\n### Parameters\n\n- __message__: The message is provided by the device's native code. _(String)_\n\n\n## cameraSuccess\n\nonSuccess callback function that provides the image data.\n\n    function(imageData) {\n        // Do something with the image\n    }\n\n### Parameters\n\n- __imageData__: Base64 encoding of the image data, _or_ the image file URI, depending on `cameraOptions` in effect. _(String)_\n\n### Example\n\n    // Show image\n    //\n    function cameraCallback(imageData) {\n        var image = document.getElementById('myImage');\n        image.src = \"data:image/jpeg;base64,\" + imageData;\n    }\n\n\n## CameraPopoverHandle\n\nA handle to the popover dialog created by `navigator.camera.getPicture`.\n\n### Methods\n\n- __setPosition__: Set the position of the popover.\n\n### Supported Platforms\n\n- iOS\n\n### setPosition\n\nSet the position of the popover.\n\n__Parameters__:\n\n- `cameraPopoverOptions`: the `CameraPopoverOptions` that specify the new position\n\n### Example\n\n     var cameraPopoverHandle = navigator.camera.getPicture(onSuccess, onFail,\n         { destinationType: Camera.DestinationType.FILE_URI,\n           sourceType: Camera.PictureSourceType.PHOTOLIBRARY,\n           popoverOptions: new CameraPopoverOptions(300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY)\n         });\n\n     // Reposition the popover if the orientation changes.\n     window.onorientationchange = function() {\n         var cameraPopoverOptions = new CameraPopoverOptions(0, 0, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY);\n         cameraPopoverHandle.setPosition(cameraPopoverOptions);\n     }\n\n\n## CameraPopoverOptions\n\niOS-only parameters that specify the anchor element location and arrow\ndirection of the popover when selecting images from an iPad's library\nor album.\n\n    { x : 0,\n      y :  32,\n      width : 320,\n      height : 480,\n      arrowDir : Camera.PopoverArrowDirection.ARROW_ANY\n    };\n\n### CameraPopoverOptions\n\n- __x__: x pixel coordinate of screen element onto which to anchor the popover. _(Number)_\n\n- __y__: y pixel coordinate of screen element onto which to anchor the popover. _(Number)_\n\n- __width__: width, in pixels, of the screen element onto which to anchor the popover. _(Number)_\n\n- __height__: height, in pixels, of the screen element onto which to anchor the popover. _(Number)_\n\n- __arrowDir__: Direction the arrow on the popover should point.  Defined in `Camera.PopoverArrowDirection` _(Number)_\n\n            Camera.PopoverArrowDirection = {\n                ARROW_UP : 1,        // matches iOS UIPopoverArrowDirection constants\n                ARROW_DOWN : 2,\n                ARROW_LEFT : 4,\n                ARROW_RIGHT : 8,\n                ARROW_ANY : 15\n            };\n\nNote that the size of the popover may change to adjust to the\ndirection of the arrow and orientation of the screen.  Make sure to\naccount for orientation changes when specifying the anchor element\nlocation.\n\n## navigator.camera.cleanup\n\nRemoves intermediate photos taken by the camera from temporary\nstorage.\n\n    navigator.camera.cleanup( cameraSuccess, cameraError );\n\n### Description\n\nRemoves intermediate image files that are kept in temporary storage\nafter calling `camera.getPicture`. Applies only when the value of\n`Camera.sourceType` equals `Camera.PictureSourceType.CAMERA` and the\n`Camera.destinationType` equals `Camera.DestinationType.FILE_URI`.\n\n### Supported Platforms\n\n- iOS\n\n### Example\n\n    navigator.camera.cleanup(onSuccess, onFail);\n\n    function onSuccess() {\n        console.log(\"Camera cleanup success.\")\n    }\n\n    function onFail(message) {\n        alert('Failed because: ' + message);\n    }\n\n"
}