Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 5 | * You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | /* Camera regions are used to set focus and metering areas; |
michael@0 | 9 | the coordinates are referenced to the sensor: |
michael@0 | 10 | (-1000, -1000) is the top-left corner |
michael@0 | 11 | (1000, 1000) is the bottom-right corner |
michael@0 | 12 | The weight of the region can range from 0 to 1000. */ |
michael@0 | 13 | dictionary CameraRegion |
michael@0 | 14 | { |
michael@0 | 15 | long top = -1000; |
michael@0 | 16 | long left = -1000; |
michael@0 | 17 | long bottom = 1000; |
michael@0 | 18 | long right = 1000; |
michael@0 | 19 | unsigned long weight = 1000; |
michael@0 | 20 | }; |
michael@0 | 21 | |
michael@0 | 22 | /* The position information to record in the image header. |
michael@0 | 23 | 'NaN' indicates the information is not available. */ |
michael@0 | 24 | dictionary CameraPosition |
michael@0 | 25 | { |
michael@0 | 26 | unrestricted double latitude = NaN; |
michael@0 | 27 | unrestricted double longitude = NaN; |
michael@0 | 28 | unrestricted double altitude = NaN; |
michael@0 | 29 | unrestricted double timestamp = NaN; |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | /* |
michael@0 | 33 | Options for takePicture(). |
michael@0 | 34 | */ |
michael@0 | 35 | dictionary CameraPictureOptions |
michael@0 | 36 | { |
michael@0 | 37 | /* an object with a combination of 'height' and 'width' properties |
michael@0 | 38 | chosen from CameraCapabilities.pictureSizes */ |
michael@0 | 39 | CameraSize pictureSize = null; |
michael@0 | 40 | |
michael@0 | 41 | /* one of the file formats chosen from |
michael@0 | 42 | CameraCapabilities.fileFormats */ |
michael@0 | 43 | DOMString fileFormat = ""; |
michael@0 | 44 | |
michael@0 | 45 | /* the rotation of the image in degrees, from 0 to 270 in |
michael@0 | 46 | steps of 90; this doesn't affect the image, only the |
michael@0 | 47 | rotation recorded in the image header.*/ |
michael@0 | 48 | long rotation = 0; |
michael@0 | 49 | |
michael@0 | 50 | /* an object containing any or all of 'latitude', 'longitude', |
michael@0 | 51 | 'altitude', and 'timestamp', used to record when and where |
michael@0 | 52 | the image was taken. e.g. |
michael@0 | 53 | { |
michael@0 | 54 | latitude: 43.647118, |
michael@0 | 55 | longitude: -79.3943, |
michael@0 | 56 | altitude: 500 |
michael@0 | 57 | // timestamp not specified, in this case, and |
michael@0 | 58 | // won't be included in the image header |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | can be null in the case where position information isn't |
michael@0 | 62 | available/desired. |
michael@0 | 63 | |
michael@0 | 64 | 'altitude' is in metres; 'timestamp' is UTC, in seconds from |
michael@0 | 65 | January 1, 1970. |
michael@0 | 66 | */ |
michael@0 | 67 | CameraPosition position = null; |
michael@0 | 68 | |
michael@0 | 69 | /* the number of seconds from January 1, 1970 UTC. This can be |
michael@0 | 70 | different from the positional timestamp (above). */ |
michael@0 | 71 | // XXXbz this should really accept a date too, no? |
michael@0 | 72 | long long dateTime = 0; |
michael@0 | 73 | }; |
michael@0 | 74 | |
michael@0 | 75 | /* These properties affect the actual video recording, e.g. |
michael@0 | 76 | { |
michael@0 | 77 | rotation: 0, |
michael@0 | 78 | maxFileSizeBytes: 1024 * 1024, |
michael@0 | 79 | maxVideoLengthMs: 0 |
michael@0 | 80 | } |
michael@0 | 81 | |
michael@0 | 82 | 'rotation' is the degrees clockwise to rotate the recorded video; if |
michael@0 | 83 | this options is not supported, it will be ignored; if this option is |
michael@0 | 84 | missing, the default is 0. |
michael@0 | 85 | |
michael@0 | 86 | 'maxFileSizeBytes' is the maximum size in bytes to which the recorded |
michael@0 | 87 | video file will be allowed to grow. |
michael@0 | 88 | |
michael@0 | 89 | 'maxVideoLengthMs' is the maximum length in milliseconds to which the |
michael@0 | 90 | recorded video will be allowed to grow. |
michael@0 | 91 | |
michael@0 | 92 | if either 'maxFileSizeBytes' or 'maxVideoLengthMs' is missing, zero, |
michael@0 | 93 | or negative, that limit will be disabled. |
michael@0 | 94 | */ |
michael@0 | 95 | dictionary CameraStartRecordingOptions |
michael@0 | 96 | { |
michael@0 | 97 | long rotation = 0; |
michael@0 | 98 | long long maxFileSizeBytes = 0; |
michael@0 | 99 | long long maxVideoLengthMs = 0; |
michael@0 | 100 | |
michael@0 | 101 | /* If startRecording() is called with flashMode set to "auto" and the |
michael@0 | 102 | camera has determined that the scene is poorly lit, the flash mode |
michael@0 | 103 | will be automatically changed to "torch" until stopRecording() is |
michael@0 | 104 | called. During this time, flashMode will reflect the new setting. If |
michael@0 | 105 | flashMode is changed while recording is in progress, the new setting |
michael@0 | 106 | will be left as-is on stopRecording(). If the camera does not |
michael@0 | 107 | support this setting, it will be ignored. */ |
michael@0 | 108 | boolean autoEnableLowLightTorch = false; |
michael@0 | 109 | }; |
michael@0 | 110 | |
michael@0 | 111 | callback CameraSetConfigurationCallback = void (CameraConfiguration configuration); |
michael@0 | 112 | callback CameraAutoFocusCallback = void (boolean focused); |
michael@0 | 113 | callback CameraTakePictureCallback = void (Blob picture); |
michael@0 | 114 | callback CameraStartRecordingCallback = void (); |
michael@0 | 115 | callback CameraShutterCallback = void (); |
michael@0 | 116 | callback CameraClosedCallback = void (); |
michael@0 | 117 | callback CameraReleaseCallback = void (); |
michael@0 | 118 | callback CameraRecorderStateChange = void (DOMString newState); |
michael@0 | 119 | callback CameraPreviewStateChange = void (DOMString newState); |
michael@0 | 120 | callback CameraAutoFocusMovingCallback = void (boolean isMoving); |
michael@0 | 121 | |
michael@0 | 122 | /* |
michael@0 | 123 | attributes here affect the preview, any pictures taken, and/or |
michael@0 | 124 | any video recorded by the camera. |
michael@0 | 125 | */ |
michael@0 | 126 | [Func="nsDOMCameraControl::HasSupport"] |
michael@0 | 127 | interface CameraControl : MediaStream |
michael@0 | 128 | { |
michael@0 | 129 | [Constant, Cached] |
michael@0 | 130 | readonly attribute CameraCapabilities capabilities; |
michael@0 | 131 | |
michael@0 | 132 | /* one of the values chosen from capabilities.effects; |
michael@0 | 133 | default is "none" */ |
michael@0 | 134 | [Throws] |
michael@0 | 135 | attribute DOMString effect; |
michael@0 | 136 | |
michael@0 | 137 | /* one of the values chosen from capabilities.whiteBalanceModes; |
michael@0 | 138 | default is "auto" */ |
michael@0 | 139 | [Throws] |
michael@0 | 140 | attribute DOMString whiteBalanceMode; |
michael@0 | 141 | |
michael@0 | 142 | /* one of the values chosen from capabilities.sceneModes; |
michael@0 | 143 | default is "auto" */ |
michael@0 | 144 | [Throws] |
michael@0 | 145 | attribute DOMString sceneMode; |
michael@0 | 146 | |
michael@0 | 147 | /* one of the values chosen from capabilities.flashModes; |
michael@0 | 148 | default is "auto" */ |
michael@0 | 149 | [Throws] |
michael@0 | 150 | attribute DOMString flashMode; |
michael@0 | 151 | |
michael@0 | 152 | /* one of the values chosen from capabilities.focusModes; |
michael@0 | 153 | default is "auto", if supported, or "fixed" */ |
michael@0 | 154 | [Throws] |
michael@0 | 155 | attribute DOMString focusMode; |
michael@0 | 156 | |
michael@0 | 157 | /* one of the values chosen from capabilities.zoomRatios; other |
michael@0 | 158 | values will be rounded to the nearest supported value; |
michael@0 | 159 | default is 1.0 */ |
michael@0 | 160 | [Throws] |
michael@0 | 161 | attribute double zoom; |
michael@0 | 162 | |
michael@0 | 163 | /* an array of one or more objects that define where the |
michael@0 | 164 | camera will perform light metering, each defining the properties: |
michael@0 | 165 | { |
michael@0 | 166 | top: -1000, |
michael@0 | 167 | left: -1000, |
michael@0 | 168 | bottom: 1000, |
michael@0 | 169 | right: 1000, |
michael@0 | 170 | weight: 1000 |
michael@0 | 171 | } |
michael@0 | 172 | |
michael@0 | 173 | 'top', 'left', 'bottom', and 'right' all range from -1000 at |
michael@0 | 174 | the top-/leftmost of the sensor to 1000 at the bottom-/rightmost |
michael@0 | 175 | of the sensor. |
michael@0 | 176 | |
michael@0 | 177 | objects missing one or more of these properties will be ignored; |
michael@0 | 178 | if the array contains more than capabilities.maxMeteringAreas, |
michael@0 | 179 | extra areas will be ignored. |
michael@0 | 180 | |
michael@0 | 181 | this attribute can be set to null to allow the camera to determine |
michael@0 | 182 | where to perform light metering. */ |
michael@0 | 183 | [Throws] |
michael@0 | 184 | attribute any meteringAreas; |
michael@0 | 185 | |
michael@0 | 186 | /* an array of one or more objects that define where the camera will |
michael@0 | 187 | perform auto-focusing, with the same definition as meteringAreas. |
michael@0 | 188 | |
michael@0 | 189 | if the array contains more than capabilities.maxFocusAreas, extra |
michael@0 | 190 | areas will be ignored. |
michael@0 | 191 | |
michael@0 | 192 | this attribute can be set to null to allow the camera to determine |
michael@0 | 193 | where to focus. */ |
michael@0 | 194 | [Throws] |
michael@0 | 195 | attribute any focusAreas; |
michael@0 | 196 | |
michael@0 | 197 | /* focal length in millimetres */ |
michael@0 | 198 | [Throws] |
michael@0 | 199 | readonly attribute double focalLength; |
michael@0 | 200 | |
michael@0 | 201 | /* the distances in metres to where the image subject appears to be |
michael@0 | 202 | in focus. 'focusDistanceOptimum' is where the subject will appear |
michael@0 | 203 | sharpest; the difference between 'focusDistanceFar' and |
michael@0 | 204 | 'focusDistanceNear' is the image's depth of field. |
michael@0 | 205 | |
michael@0 | 206 | 'focusDistanceFar' may be infinity. */ |
michael@0 | 207 | [Throws] |
michael@0 | 208 | readonly attribute double focusDistanceNear; |
michael@0 | 209 | [Throws] |
michael@0 | 210 | readonly attribute double focusDistanceOptimum; |
michael@0 | 211 | [Throws] |
michael@0 | 212 | readonly attribute unrestricted double focusDistanceFar; |
michael@0 | 213 | |
michael@0 | 214 | /* 'compensation' is optional, and if missing, will |
michael@0 | 215 | set the camera to use automatic exposure compensation. |
michael@0 | 216 | |
michael@0 | 217 | acceptable values must range from minExposureCompensation |
michael@0 | 218 | to maxExposureCompensation in steps of stepExposureCompensation; |
michael@0 | 219 | invalid values will be rounded to the nearest valid value. */ |
michael@0 | 220 | [Throws] |
michael@0 | 221 | void setExposureCompensation(optional double compensation); |
michael@0 | 222 | [Throws] |
michael@0 | 223 | readonly attribute unrestricted double exposureCompensation; |
michael@0 | 224 | |
michael@0 | 225 | /* one of the values chosen from capabilities.isoModes; default |
michael@0 | 226 | value is "auto" if supported. */ |
michael@0 | 227 | [Throws] |
michael@0 | 228 | attribute DOMString isoMode; |
michael@0 | 229 | |
michael@0 | 230 | /* the function to call on the camera's shutter event, to trigger |
michael@0 | 231 | a shutter sound and/or a visual shutter indicator. */ |
michael@0 | 232 | attribute CameraShutterCallback? onShutter; |
michael@0 | 233 | |
michael@0 | 234 | /* the function to call when the camera hardware is closed |
michael@0 | 235 | by the underlying framework, e.g. when another app makes a more |
michael@0 | 236 | recent call to get the camera. */ |
michael@0 | 237 | attribute CameraClosedCallback? onClosed; |
michael@0 | 238 | |
michael@0 | 239 | /* the function to call when the recorder changes state, either because |
michael@0 | 240 | the recording process encountered an error, or because one of the |
michael@0 | 241 | recording limits (see CameraStartRecordingOptions) was reached. */ |
michael@0 | 242 | attribute CameraRecorderStateChange? onRecorderStateChange; |
michael@0 | 243 | |
michael@0 | 244 | /* the function to call when the viewfinder stops or starts, |
michael@0 | 245 | useful for synchronizing other UI elements. */ |
michael@0 | 246 | attribute CameraPreviewStateChange? onPreviewStateChange; |
michael@0 | 247 | |
michael@0 | 248 | /* the size of the picture to be returned by a call to takePicture(); |
michael@0 | 249 | an object with 'height' and 'width' properties that corresponds to |
michael@0 | 250 | one of the options returned by capabilities.pictureSizes. */ |
michael@0 | 251 | [Throws] |
michael@0 | 252 | attribute any pictureSize; |
michael@0 | 253 | |
michael@0 | 254 | /* the size of the thumbnail to be included in the picture returned |
michael@0 | 255 | by a call to takePicture(), assuming the chosen fileFormat supports |
michael@0 | 256 | one; an object with 'height' and 'width' properties that corresponds |
michael@0 | 257 | to one of the options returned by capabilities.pictureSizes. |
michael@0 | 258 | |
michael@0 | 259 | this setting should be considered a hint: the implementation will |
michael@0 | 260 | respect it when possible, and override it if necessary. */ |
michael@0 | 261 | [Throws] |
michael@0 | 262 | attribute any thumbnailSize; |
michael@0 | 263 | |
michael@0 | 264 | /* the angle, in degrees, that the image sensor is mounted relative |
michael@0 | 265 | to the display; e.g. if 'sensorAngle' is 270 degrees (or -90 degrees), |
michael@0 | 266 | then the preview stream needs to be rotated +90 degrees to have the |
michael@0 | 267 | same orientation as the real world. */ |
michael@0 | 268 | readonly attribute long sensorAngle; |
michael@0 | 269 | |
michael@0 | 270 | /* tell the camera to attempt to focus the image */ |
michael@0 | 271 | [Throws] |
michael@0 | 272 | void autoFocus(CameraAutoFocusCallback onSuccess, optional CameraErrorCallback onError); |
michael@0 | 273 | |
michael@0 | 274 | /* if continuous autofocus is supported and focusMode is set to enable it, |
michael@0 | 275 | then this function is called whenever the camera decides to start and |
michael@0 | 276 | stop moving the focus position; it can be used to update a UI element to |
michael@0 | 277 | indicate that the camera is still trying to focus, or has finished. Some |
michael@0 | 278 | platforms do not support this event, in which case the callback is never |
michael@0 | 279 | invoked. */ |
michael@0 | 280 | [Pref="camera.control.autofocus_moving_callback.enabled"] |
michael@0 | 281 | attribute CameraAutoFocusMovingCallback? onAutoFocusMoving; |
michael@0 | 282 | |
michael@0 | 283 | /* capture an image and return it as a blob to the 'onSuccess' callback; |
michael@0 | 284 | if the camera supports it, this may be invoked while the camera is |
michael@0 | 285 | already recording video. |
michael@0 | 286 | |
michael@0 | 287 | invoking this function will stop the preview stream, which must be |
michael@0 | 288 | manually restarted (e.g. by calling .play() on it). */ |
michael@0 | 289 | [Throws] |
michael@0 | 290 | void takePicture(CameraPictureOptions aOptions, |
michael@0 | 291 | CameraTakePictureCallback onSuccess, |
michael@0 | 292 | optional CameraErrorCallback onError); |
michael@0 | 293 | |
michael@0 | 294 | /* start recording video; 'aOptions' is a |
michael@0 | 295 | CameraStartRecordingOptions object. */ |
michael@0 | 296 | [Throws] |
michael@0 | 297 | void startRecording(CameraStartRecordingOptions aOptions, |
michael@0 | 298 | DeviceStorage storageArea, |
michael@0 | 299 | DOMString filename, |
michael@0 | 300 | CameraStartRecordingCallback onSuccess, |
michael@0 | 301 | optional CameraErrorCallback onError); |
michael@0 | 302 | |
michael@0 | 303 | /* stop precording video. */ |
michael@0 | 304 | [Throws] |
michael@0 | 305 | void stopRecording(); |
michael@0 | 306 | |
michael@0 | 307 | /* call in or after the takePicture() onSuccess callback to |
michael@0 | 308 | resume the camera preview stream. */ |
michael@0 | 309 | [Throws] |
michael@0 | 310 | void resumePreview(); |
michael@0 | 311 | |
michael@0 | 312 | /* release the camera so that other applications can use it; you should |
michael@0 | 313 | probably call this whenever the camera is not longer in the foreground |
michael@0 | 314 | (depending on your usage model). |
michael@0 | 315 | |
michael@0 | 316 | the callbacks are optional, unless you really need to know when |
michael@0 | 317 | the hardware is ultimately released. |
michael@0 | 318 | |
michael@0 | 319 | once this is called, the camera control object is to be considered |
michael@0 | 320 | defunct; a new instance will need to be created to access the camera. */ |
michael@0 | 321 | [Throws] |
michael@0 | 322 | void release(optional CameraReleaseCallback onSuccess, |
michael@0 | 323 | optional CameraErrorCallback onError); |
michael@0 | 324 | |
michael@0 | 325 | /* changes the camera configuration on the fly; |
michael@0 | 326 | 'configuration' is of type CameraConfiguration. |
michael@0 | 327 | |
michael@0 | 328 | XXXmikeh the 'configuration' argument needs to be optional, else |
michael@0 | 329 | the WebIDL compiler throws: "WebIDL.WebIDLError: error: Dictionary |
michael@0 | 330 | argument or union argument containing a dictionary not followed by |
michael@0 | 331 | a required argument must be optional" |
michael@0 | 332 | */ |
michael@0 | 333 | [Throws] |
michael@0 | 334 | void setConfiguration(optional CameraConfiguration configuration, |
michael@0 | 335 | optional CameraSetConfigurationCallback onSuccess, |
michael@0 | 336 | optional CameraErrorCallback onError); |
michael@0 | 337 | |
michael@0 | 338 | /* if focusMode is set to either 'continuous-picture' or 'continuous-video', |
michael@0 | 339 | then calling autoFocus() will trigger its onSuccess callback immediately |
michael@0 | 340 | if the camera was either successfully focused, or if no focus could be |
michael@0 | 341 | acquired; if the focus acquisition is still in progress, the onSuccess |
michael@0 | 342 | callback will be invoked later, its argument indicating success or |
michael@0 | 343 | failure. |
michael@0 | 344 | |
michael@0 | 345 | once autoFocus() is called with a continuous autofocus mode set, the |
michael@0 | 346 | continuous autofocus process is stopped and focus is locked in the |
michael@0 | 347 | current state until this method is called. |
michael@0 | 348 | */ |
michael@0 | 349 | [Throws] |
michael@0 | 350 | void resumeContinuousFocus(); |
michael@0 | 351 | }; |
michael@0 | 352 | |
michael@0 | 353 | /* The coordinates of a point, relative to the camera sensor, of the center of |
michael@0 | 354 | detected facial features. As with CameraRegions: |
michael@0 | 355 | { x: -1000, y: -1000 } is the top-left corner |
michael@0 | 356 | { x: 1000, y: 1000 } is the bottom-right corner |
michael@0 | 357 | x and y can range from -1000 to 1000. |
michael@0 | 358 | */ |
michael@0 | 359 | [Pref="camera.control.face_detection.enabled", Func="DOMCameraPoint::HasSupport"] |
michael@0 | 360 | interface CameraPoint |
michael@0 | 361 | { |
michael@0 | 362 | attribute long x; |
michael@0 | 363 | attribute long y; |
michael@0 | 364 | }; |
michael@0 | 365 | |
michael@0 | 366 | /* The information of the each face detected by a camera device, e.g. |
michael@0 | 367 | { |
michael@0 | 368 | id: 1, |
michael@0 | 369 | score: 80, |
michael@0 | 370 | bound: { left: -203, |
michael@0 | 371 | top: -400, |
michael@0 | 372 | right: 300, |
michael@0 | 373 | bottom: 250 }, |
michael@0 | 374 | leftEye: { x: -100, |
michael@0 | 375 | y: -200 }, |
michael@0 | 376 | rightEye: { x: 100, |
michael@0 | 377 | y: 100 }, |
michael@0 | 378 | mouth: { x: 150, |
michael@0 | 379 | y: 150 } } |
michael@0 | 380 | |
michael@0 | 381 | 'id' is an unique value per face while the face is visible to the tracker. |
michael@0 | 382 | If the face leaves the viewfinder and then returns, it will be assigned |
michael@0 | 383 | a new value. |
michael@0 | 384 | |
michael@0 | 385 | 'score' is the confidence level for the detection of the face. |
michael@0 | 386 | This range is 1 to 100, where 100 is the highest confidence. |
michael@0 | 387 | |
michael@0 | 388 | 'bounds' is the bounds of the face. It is guaranteed left < right and |
michael@0 | 389 | top < bottom. The coordinates can be smaller than -1000 or bigger than 1000. |
michael@0 | 390 | But at least one vertex will be within (-1000, -1000) and (1000, 1000). |
michael@0 | 391 | |
michael@0 | 392 | 'leftEye' is the coordinates of the centre of the left eye. The coordinates |
michael@0 | 393 | are in the same space as the ones for 'bounds'. This is an optional field |
michael@0 | 394 | and may not be supported on all devices. If it is not supported or detected, |
michael@0 | 395 | the value will be set to null. |
michael@0 | 396 | |
michael@0 | 397 | 'rightEye' is the coordinates of the detected right eye; null if not |
michael@0 | 398 | supported or detected. |
michael@0 | 399 | |
michael@0 | 400 | 'mouth' is the coordinates of the detected mouth; null if not supported or |
michael@0 | 401 | detected. |
michael@0 | 402 | */ |
michael@0 | 403 | [Pref="camera.control.face_detection.enabled", Func="DOMCameraDetectedFace::HasSupport"] |
michael@0 | 404 | interface CameraDetectedFace |
michael@0 | 405 | { |
michael@0 | 406 | readonly attribute unsigned long id; |
michael@0 | 407 | |
michael@0 | 408 | readonly attribute unsigned long score; |
michael@0 | 409 | |
michael@0 | 410 | readonly attribute DOMRect bounds; |
michael@0 | 411 | |
michael@0 | 412 | readonly attribute boolean hasLeftEye; |
michael@0 | 413 | readonly attribute CameraPoint? leftEye; |
michael@0 | 414 | |
michael@0 | 415 | readonly attribute boolean hasRightEye; |
michael@0 | 416 | readonly attribute CameraPoint? rightEye; |
michael@0 | 417 | |
michael@0 | 418 | readonly attribute boolean hasMouth; |
michael@0 | 419 | readonly attribute CameraPoint? mouth; |
michael@0 | 420 | }; |
michael@0 | 421 | |
michael@0 | 422 | callback CameraFaceDetectionCallback = void (sequence<CameraDetectedFace> faces); |
michael@0 | 423 | |
michael@0 | 424 | partial interface CameraControl |
michael@0 | 425 | { |
michael@0 | 426 | /* Starts the face detection. This should be called after the preview is |
michael@0 | 427 | started. The camera will periodically call 'onFacesDetected' with a |
michael@0 | 428 | sequence of zero or one or more detected faces in the preview frame. |
michael@0 | 429 | |
michael@0 | 430 | How often the callback is invoked is implementation dependent. |
michael@0 | 431 | |
michael@0 | 432 | This method throws an exception if face detection fails to start. |
michael@0 | 433 | */ |
michael@0 | 434 | [Throws, Pref="camera.control.face_detection.enabled"] |
michael@0 | 435 | void startFaceDetection(); |
michael@0 | 436 | |
michael@0 | 437 | /* Stops the face detection. |
michael@0 | 438 | |
michael@0 | 439 | This method throws an exception if face detection can't be stopped. |
michael@0 | 440 | */ |
michael@0 | 441 | [Throws, Pref="camera.control.face_detection.enabled"] |
michael@0 | 442 | void stopFaceDetection(); |
michael@0 | 443 | |
michael@0 | 444 | /* Callback for faces detected in the preview frame. If no faces are |
michael@0 | 445 | detected, the callback is invoked with an empty sequence. */ |
michael@0 | 446 | [Pref="camera.control.face_detection.enabled"] |
michael@0 | 447 | attribute CameraFaceDetectionCallback? onFacesDetected; |
michael@0 | 448 | }; |