• Skip to main content
  • Select language
  • Skip to search
mozilla
Mozilla Developer Network
  • Sign in
    • Persona
    • GitHub
  • Web Platform
    Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • APIs / DOM
    • Apps
    • MathML
    References & Guides
    • Learn the Web
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • ...more docs
  • Mozilla Docs
    • Add-ons
    • Firefox
    • Firefox Marketplace
    • Firefox OS
    • Persona
  • Developer Tools
  • Feedback
    • Get Firefox help
    • Get web development help
    • Join the MDN community
    • Report a content problem
    • Report a bug
  •  
B2G OS
    • 日本語
    • Português (do Brasil)
    • 中文 (简体)
    • Add a translation
  • Edit
  • Advanced
    • History
    • Print this article
  1. MDN
  2. Mozilla
  3. B2G OS
  4. Firefox OS APIs
  5. CameraControl
Your Search Results

    CameraControl

    In This Article
    1. Properties
    2. Methods
    3. Specification
    4. Permissions
    5. See also

    This API is available on Firefox OS for privileged or certified applications only.

    When you use the CameraManager.getCamera() method to get a reference to a camera, you specify a callback function to be invoked on success. That function receives as a parameter a CameraControl object. You can use its methods and properties to manage and make use of the camera.

    Properties

    CameraControl.capabilities Read only
    A CameraCapabilities object indicating all the capabilities for the given camera.
    CameraControl.effect
    A string defining the effect to be used by the camera (none by default). Its value must be one of the values available in CameraCapabilities.effects.
    CameraControl.exposureCompensation Read only
    A value used to compensate the camera exposure. This attribute is read-only; to change the exposure, you need to call the CameraControl.setExposureCompensation() method.
    CameraControl.flashMode
    A string that defines how the flash, if any, is to be used; this is auto by default if the device has a flash, none otherwise. When set, its value must be chosen from the list of options specified by  CameraCapabilities.flashModes.
    CameraControl.focalLength Read only
    A number that express the camera's focal length in millimeters.
    CameraControl.focusAreas
    An Array of one or more objects that define where the camera will perform auto-focusing.
    CameraControl.focusDistanceFar Read only
    This value is a distance in meter used with CameraControl.focusDistanceNear to defined the image's depth of field. The value for this property may be Infinity.
    CameraControl.focusDistanceNear Read only
    This value is a distance in meter used with CameraControl.focusDistanceFar to defined the image's depth of field.
    CameraControl.focusDistanceOptimum Read only
    This value is a distance in meter where the subject will appear sharpest.
    CameraControl.focusMode
    A string that defines which kind of focus mode the camera should use (auto or fixed by default). Its value must be chosen from CameraCapabilities.focusModes.
    CameraControl.meteringAreas
    An Array of one or more objects that define where the camera will perform auto-focusing.
    CameraControl.onShutter
    A handler for the camera's "shutter" event, to trigger a shutter sound and/or a visual shutter indicator.
    CameraControl.onClosed
    A handler called when a new CameraControl object in the same app takes over the camera.
    CameraControl.onRecorderStateChange
    A function to call when the recorder changes state, either because the recording process encountered an error, or because one of the recording limits (see CameraControl.startRecording()) was reached.
    CameraControl.sceneMode
    A string that defines which scene mode the camera is to use (auto by default). Its value must be chosen from CameraCapabilities.sceneModes.
    CameraControl.whiteBalanceMode
    A string that defines which white balance mode the camera is to use (auto by default). Its value must be chosen from CameraCapabilities.whiteBalanceModes.
    CameraControl.zoom
    A number that defines which kind of zoom factor mode the camera is to use (1 by default). Its value must be chosen from CameraCapabilities.zoomRatios.

    Methods

    CameraControl.autoFocus()
    Tells the camera to attempt to focus the image.
    CameraControl.getPreviewStream()
    Gets a video stream from the camera; you can use this in an arbitrary context.
    CameraControl.getPreviewStreamVideoMode()
    Gets a video stream from the camera based on a specific video mode.
    CameraControl.release()
    Releases the camera so that other applications can use it.
    CameraControl.resumePreview()
    Resumes the preview video stream after it's been paused by a call to CameraControl.takePicture().
    CameraControl.setConfiguration()
    Lets you perform ad-hoc configuration changes.
    CameraControl.setExposureCompensation()
    Lets you specify the exposure compensation factor.
    CameraControl.startRecording()
    Lets you start recording a video stream.
    CameraControl.stopRecording()
    Lets you stop recording a video stream.
    CameraControl.pauseRecording()
    Pauses the recording of a video stream.
    CameraControl.resumeRecording()
    Resumes the recording of a video stream that has previously been paused.
    CameraControl.takePicture()
    Lets you capture a single image, receiving it as a Blob.

    Specification

    Not part of any specification as yet; this will probably be replaced by WebRTC when it gains more widespread support on mobile devices.

    Permissions

    Up until Firefox OS 1.4, The Camera API was a certified API, so not accessible to third party apps. From Firefox OS 2.0 onwards, the permission level has been downgraded to privileged, so it is now available for developers to use in their apps.

    "permissions": {
      "camera": {
        "description": "Required for accessing cameras on the device."
      }
    }

    See also

    • CameraManager
    • CameraCapabilities
    • navigator.mozCamera
    Share:
    • Twitter
    • Facebook
    • Google+

    Document Tags and Contributors

    Tags: 
    • API
    • DOM
    • DOM Reference
    • Firefox OS
    • Graphics
    • JavaScript
    • Reference
    • Référence
     Contributors to this page: chrisdavidmills, Cfinke, teoli, jsx, Ehsan, kscarfone, Sheppy, Jeremie
     Last updated by: chrisdavidmills, Feb 11, 2016, 2:43:54 AM
    See also
    1. Camera API
    2. CameraControl
    3. Properties
      1. capabilities
      2. effect
      3. exposureCompensation
      4. flashMode
      5. focalLength
      6. focusAreas
      7. focusDistanceFar
      8. focusDistanceNear
      9. focusDistanceOptimum
      10. focusMode
      11. meteringAreas
      12. onClosed
      13. onRecorderStateChange
      14. onShutter
      15. sceneMode
      16. whiteBalanceMode
      17. zoom
    4. Methods
      1. autoFocus()
      2. getPreviewStream()
      3. getPreviewStreamVideoMode()
      4. pauseRecording()
      5. release()
      6. resumePreview()
      7. resumeRecording()
      8. setConfiguration()
      9. setExposureCompensation()
      10. startRecording()
      11. stopRecording()
      12. takePicture()
    5. Inheritance:
      1. MediaStream
      2. EventTarget
    6. Related pages for Camera API
      1. CameraCapabilities
      2. CameraManager
      3. Navigator.mozCameras

    © 2005-2016 Mozilla Developer Network and individual contributors.

    Content is available under these licenses.

    • About MDN
    • Terms
    • Privacy
    • Cookies
    • Contribute to the code

    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy