1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { ErrorCallback, AsyncCallback } from './@ohos.base'; 17import type Context from './application/BaseContext'; 18import image from './@ohos.multimedia.image'; 19import type colorSpaceManager from './@ohos.graphics.colorSpaceManager'; 20 21/** 22 * @namespace camera 23 * @syscap SystemCapability.Multimedia.Camera.Core 24 * @since 10 25 */ 26declare namespace camera { 27 /** 28 * Creates a CameraManager instance. 29 * 30 * @param { Context } context - Current application context. 31 * @returns { CameraManager } CameraManager instance. 32 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 33 * @throws { BusinessError } 7400201 - Camera service fatal error. 34 * @syscap SystemCapability.Multimedia.Camera.Core 35 * @since 10 36 */ 37 function getCameraManager(context: Context): CameraManager; 38 39 /** 40 * Enum for camera status. 41 * 42 * @enum { number } 43 * @syscap SystemCapability.Multimedia.Camera.Core 44 * @since 10 45 */ 46 enum CameraStatus { 47 /** 48 * Appear status. 49 * 50 * @syscap SystemCapability.Multimedia.Camera.Core 51 * @since 10 52 */ 53 CAMERA_STATUS_APPEAR = 0, 54 55 /** 56 * Disappear status. 57 * 58 * @syscap SystemCapability.Multimedia.Camera.Core 59 * @since 10 60 */ 61 CAMERA_STATUS_DISAPPEAR = 1, 62 63 /** 64 * Available status. 65 * 66 * @syscap SystemCapability.Multimedia.Camera.Core 67 * @since 10 68 */ 69 CAMERA_STATUS_AVAILABLE = 2, 70 71 /** 72 * Unavailable status. 73 * 74 * @syscap SystemCapability.Multimedia.Camera.Core 75 * @since 10 76 */ 77 CAMERA_STATUS_UNAVAILABLE = 3 78 } 79 80 /** 81 * Profile for camera streams. 82 * 83 * @typedef Profile 84 * @syscap SystemCapability.Multimedia.Camera.Core 85 * @since 10 86 */ 87 interface Profile { 88 /** 89 * Camera format. 90 * 91 * @type { CameraFormat } 92 * @readonly 93 * @syscap SystemCapability.Multimedia.Camera.Core 94 * @since 10 95 */ 96 readonly format: CameraFormat; 97 98 /** 99 * Picture size. 100 * 101 * @type { Size } 102 * @readonly 103 * @syscap SystemCapability.Multimedia.Camera.Core 104 * @since 10 105 */ 106 readonly size: Size; 107 } 108 109 /** 110 * Frame rate range. 111 * 112 * @typedef FrameRateRange 113 * @syscap SystemCapability.Multimedia.Camera.Core 114 * @since 10 115 */ 116 interface FrameRateRange { 117 /** 118 * Min frame rate. 119 * 120 * @type { number } 121 * @readonly 122 * @syscap SystemCapability.Multimedia.Camera.Core 123 * @since 10 124 */ 125 readonly min: number; 126 127 /** 128 * Max frame rate. 129 * 130 * @type { number } 131 * @readonly 132 * @syscap SystemCapability.Multimedia.Camera.Core 133 * @since 10 134 */ 135 readonly max: number; 136 } 137 138 /** 139 * Video profile. 140 * 141 * @typedef VideoProfile 142 * @syscap SystemCapability.Multimedia.Camera.Core 143 * @since 10 144 */ 145 interface VideoProfile extends Profile { 146 /** 147 * Frame rate in unit fps (frames per second). 148 * 149 * @type { FrameRateRange } 150 * @readonly 151 * @syscap SystemCapability.Multimedia.Camera.Core 152 * @since 10 153 */ 154 readonly frameRateRange: FrameRateRange; 155 } 156 157 /** 158 * Camera output capability. 159 * 160 * @typedef CameraOutputCapability 161 * @syscap SystemCapability.Multimedia.Camera.Core 162 * @since 10 163 */ 164 interface CameraOutputCapability { 165 /** 166 * Preview profiles. 167 * 168 * @type { Array<Profile> } 169 * @readonly 170 * @syscap SystemCapability.Multimedia.Camera.Core 171 * @since 10 172 */ 173 readonly previewProfiles: Array<Profile>; 174 175 /** 176 * Photo profiles. 177 * 178 * @type { Array<Profile> } 179 * @readonly 180 * @syscap SystemCapability.Multimedia.Camera.Core 181 * @since 10 182 */ 183 readonly photoProfiles: Array<Profile>; 184 185 /** 186 * Video profiles. 187 * 188 * @type { Array<VideoProfile> } 189 * @readonly 190 * @syscap SystemCapability.Multimedia.Camera.Core 191 * @since 10 192 */ 193 readonly videoProfiles: Array<VideoProfile>; 194 195 /** 196 * All the supported metadata Object Types. 197 * 198 * @type { Array<MetadataObjectType> } 199 * @readonly 200 * @syscap SystemCapability.Multimedia.Camera.Core 201 * @since 10 202 */ 203 readonly supportedMetadataObjectTypes: Array<MetadataObjectType>; 204 } 205 206 /** 207 * Enum for camera error code. 208 * 209 * @enum { number } 210 * @syscap SystemCapability.Multimedia.Camera.Core 211 * @since 10 212 */ 213 enum CameraErrorCode { 214 /** 215 * Parameter missing or parameter type incorrect. 216 * 217 * @syscap SystemCapability.Multimedia.Camera.Core 218 * @since 10 219 */ 220 INVALID_ARGUMENT = 7400101, 221 222 /** 223 * Operation not allowed. 224 * 225 * @syscap SystemCapability.Multimedia.Camera.Core 226 * @since 10 227 */ 228 OPERATION_NOT_ALLOWED = 7400102, 229 230 /** 231 * Session not config. 232 * 233 * @syscap SystemCapability.Multimedia.Camera.Core 234 * @since 10 235 */ 236 SESSION_NOT_CONFIG = 7400103, 237 238 /** 239 * Session not running. 240 * 241 * @syscap SystemCapability.Multimedia.Camera.Core 242 * @since 10 243 */ 244 SESSION_NOT_RUNNING = 7400104, 245 246 /** 247 * Session config locked. 248 * 249 * @syscap SystemCapability.Multimedia.Camera.Core 250 * @since 10 251 */ 252 SESSION_CONFIG_LOCKED = 7400105, 253 254 /** 255 * Device setting locked. 256 * 257 * @syscap SystemCapability.Multimedia.Camera.Core 258 * @since 10 259 */ 260 DEVICE_SETTING_LOCKED = 7400106, 261 262 /** 263 * Can not use camera cause of conflict. 264 * 265 * @syscap SystemCapability.Multimedia.Camera.Core 266 * @since 10 267 */ 268 CONFLICT_CAMERA = 7400107, 269 270 /** 271 * Camera disabled cause of security reason. 272 * 273 * @syscap SystemCapability.Multimedia.Camera.Core 274 * @since 10 275 */ 276 DEVICE_DISABLED = 7400108, 277 278 /** 279 * Can not use camera cause of preempted. 280 * 281 * @syscap SystemCapability.Multimedia.Camera.Core 282 * @since 10 283 */ 284 DEVICE_PREEMPTED = 7400109, 285 286 /** 287 * Camera service fatal error. 288 * 289 * @syscap SystemCapability.Multimedia.Camera.Core 290 * @since 10 291 */ 292 SERVICE_FATAL_ERROR = 7400201 293 } 294 295 /** 296 * Enum for restore parameter. 297 * 298 * @enum { number } 299 * @syscap SystemCapability.Multimedia.Camera.Core 300 * @systemapi 301 * @since 11 302 */ 303 enum RestoreParamType { 304 /** 305 * No need set restore Stream Parameter, only prelaunch camera device. 306 * 307 * @syscap SystemCapability.Multimedia.Camera.Core 308 * @systemapi 309 * @since 11 310 */ 311 NO_NEED_RESTORE_PARAM = 0, 312 313 /** 314 * Presistent default parameter, long-lasting effect after T minutes. 315 * 316 * @syscap SystemCapability.Multimedia.Camera.Core 317 * @systemapi 318 * @since 11 319 */ 320 PRESISTENT_DEFAULT_PARAM = 1, 321 322 /** 323 * Transient active parameter, which has a higher priority than PRESISTENT_DEFAULT_PARAM when both exist. 324 * 325 * @syscap SystemCapability.Multimedia.Camera.Core 326 * @systemapi 327 * @since 11 328 */ 329 TRANSIENT_ACTIVE_PARAM = 2 330 } 331 332 /** 333 * Setting parameter for stream. 334 * 335 * @typedef SettingParam 336 * @syscap SystemCapability.Multimedia.Camera.Core 337 * @systemapi 338 * @since 11 339 */ 340 interface SettingParam { 341 /** 342 * Skin smooth level value for restore. 343 * 344 * @type { number } 345 * @syscap SystemCapability.Multimedia.Camera.Core 346 * @systemapi 347 * @since 11 348 */ 349 skinSmoothLevel: number; 350 351 /** 352 * Face slender value for restore. 353 * 354 * @type { number } 355 * @syscap SystemCapability.Multimedia.Camera.Core 356 * @systemapi 357 * @since 11 358 */ 359 faceSlender: number; 360 361 /** 362 * Skin tone value for restore. 363 * 364 * @type { number } 365 * @syscap SystemCapability.Multimedia.Camera.Core 366 * @systemapi 367 * @since 11 368 */ 369 skinTone: number; 370 } 371 372 /** 373 * Prelaunch config object. 374 * 375 * @typedef PrelaunchConfig 376 * @syscap SystemCapability.Multimedia.Camera.Core 377 * @systemapi 378 * @since 10 379 */ 380 interface PrelaunchConfig { 381 /** 382 * Camera instance. 383 * 384 * @type { CameraDevice } 385 * @syscap SystemCapability.Multimedia.Camera.Core 386 * @systemapi 387 * @since 10 388 */ 389 cameraDevice: CameraDevice; 390 391 /** 392 * Restore parameter type. 393 * 394 * @type { RestoreParamType } 395 * @syscap SystemCapability.Multimedia.Camera.Core 396 * @systemapi 397 * @since 11 398 */ 399 restoreParamType: RestoreParamType; 400 401 /** 402 * Begin activiting time. 403 * 404 * @type { number } 405 * @syscap SystemCapability.Multimedia.Camera.Core 406 * @systemapi 407 * @since 11 408 */ 409 activeTime: number; 410 411 /** 412 * Setting parameter. 413 * 414 * @type { SettingParam } 415 * @syscap SystemCapability.Multimedia.Camera.Core 416 * @systemapi 417 * @since 11 418 */ 419 settingParam: SettingParam; 420 } 421 422 /** 423 * Camera manager object. 424 * 425 * @interface CameraManager 426 * @syscap SystemCapability.Multimedia.Camera.Core 427 * @since 10 428 */ 429 interface CameraManager { 430 /** 431 * Gets supported camera descriptions. 432 * 433 * @returns { Array<CameraDevice> } An array of supported cameras. 434 * @syscap SystemCapability.Multimedia.Camera.Core 435 * @since 10 436 */ 437 getSupportedCameras(): Array<CameraDevice>; 438 439 /** 440 * Gets supported output capability for specific camera. 441 * 442 * @param { CameraDevice } camera - Camera device. 443 * @returns { CameraOutputCapability } The camera output capability. 444 * @syscap SystemCapability.Multimedia.Camera.Core 445 * @deprecated since 11 446 * @since 10 447 */ 448 getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability; 449 450 /** 451 * Gets supported scene mode for specific camera. 452 * 453 * @param { CameraDevice } camera - Camera device. 454 * @returns { Array<SceneMode> } An array of supported scene mode of camera. 455 * @syscap SystemCapability.Multimedia.Camera.Core 456 * @since 11 457 */ 458 getSupportedSceneModes(camera: CameraDevice): Array<SceneMode>; 459 460 /** 461 * Gets supported output capability for specific camera. 462 * 463 * @param { CameraDevice } camera - Camera device. 464 * @param { SceneMode } mode - Scene mode. 465 * @returns { CameraOutputCapability } The camera output capability. 466 * @syscap SystemCapability.Multimedia.Camera.Core 467 * @since 11 468 */ 469 getSupportedOutputCapability(camera: CameraDevice, mode: SceneMode): CameraOutputCapability; 470 471 /** 472 * Determine whether camera is muted. 473 * 474 * @returns { boolean } Is camera muted. 475 * @syscap SystemCapability.Multimedia.Camera.Core 476 * @since 10 477 */ 478 isCameraMuted(): boolean; 479 480 /** 481 * Determine whether camera mute is supported. 482 * 483 * @returns { boolean } Is camera mute supported. 484 * @syscap SystemCapability.Multimedia.Camera.Core 485 * @systemapi 486 * @since 10 487 */ 488 isCameraMuteSupported(): boolean; 489 490 /** 491 * Mute camera. 492 * 493 * @param { boolean } mute - Mute camera if TRUE, otherwise unmute camera. 494 * @syscap SystemCapability.Multimedia.Camera.Core 495 * @systemapi 496 * @since 10 497 */ 498 muteCamera(mute: boolean): void; 499 500 /** 501 * Creates a CameraInput instance by camera. 502 * 503 * @permission ohos.permission.CAMERA 504 * @param { CameraDevice } camera - Camera device used to create the instance. 505 * @returns { CameraInput } The CameraInput instance. 506 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 507 * @syscap SystemCapability.Multimedia.Camera.Core 508 * @since 10 509 */ 510 createCameraInput(camera: CameraDevice): CameraInput; 511 512 /** 513 * Creates a CameraInput instance by camera position and type. 514 * 515 * @permission ohos.permission.CAMERA 516 * @param { CameraPosition } position - Target camera position. 517 * @param { CameraType } type - Target camera type. 518 * @returns { CameraInput } The CameraInput instance. 519 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 520 * @syscap SystemCapability.Multimedia.Camera.Core 521 * @since 10 522 */ 523 createCameraInput(position: CameraPosition, type: CameraType): CameraInput; 524 525 /** 526 * Creates a PreviewOutput instance. 527 * 528 * @param { Profile } profile - Preview output profile. 529 * @param { string } surfaceId - Surface object id used in camera photo output. 530 * @returns { PreviewOutput } The PreviewOutput instance. 531 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 532 * @syscap SystemCapability.Multimedia.Camera.Core 533 * @since 10 534 */ 535 createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput; 536 537 /** 538 * Creates a PhotoOutput instance. 539 * 540 * @param { Profile } profile - Photo output profile. 541 * @param { string } surfaceId - Surface object id used in camera photo output. 542 * @returns { PhotoOutput } The PhotoOutput instance. 543 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 544 * @syscap SystemCapability.Multimedia.Camera.Core 545 * @deprecated since 11 546 * @since 10 547 */ 548 createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput; 549 550 /** 551 * Creates a PhotoOutput instance. 552 * 553 * @param { Profile } profile - Photo output profile. 554 * @returns { PhotoOutput } The PhotoOutput instance. 555 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 556 * @syscap SystemCapability.Multimedia.Camera.Core 557 * @since 11 558 */ 559 createPhotoOutput(profile: Profile): PhotoOutput; 560 561 /** 562 * Creates a VideoOutput instance. 563 * 564 * @param { VideoProfile } profile - Video profile. 565 * @param { string } surfaceId - Surface object id used in camera video output. 566 * @returns { VideoOutput } The VideoOutput instance. 567 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 568 * @syscap SystemCapability.Multimedia.Camera.Core 569 * @since 10 570 */ 571 createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput; 572 573 /** 574 * Creates a MetadataOutput instance. 575 * 576 * @param { Array<MetadataObjectType> } metadataObjectTypes - Array of MetadataObjectType. 577 * @returns { MetadataOutput } The MetadataOutput instance. 578 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 579 * @syscap SystemCapability.Multimedia.Camera.Core 580 * @since 10 581 */ 582 createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): MetadataOutput; 583 584 /** 585 * Gets a CaptureSession instance. 586 * 587 * @returns { CaptureSession } The CaptureSession instance. 588 * @throws { BusinessError } 7400201 - Camera service fatal error. 589 * @syscap SystemCapability.Multimedia.Camera.Core 590 * @deprecated since 11 591 * @since 10 592 */ 593 createCaptureSession(): CaptureSession; 594 595 /** 596 * Gets a Session instance by specific scene mode. 597 * 598 * @returns { T } The specific Session instance by specific scene mode. 599 * @param { SceneMode } mode - Scene mode. 600 * @throws { BusinessError } 7400201 - Camera service fatal error. 601 * @syscap SystemCapability.Multimedia.Camera.Core 602 * @since 11 603 */ 604 createSession<T extends Session>(mode: SceneMode): T; 605 606 /** 607 * Subscribes camera status change event callback. 608 * 609 * @param { 'cameraStatus' } type - Event type. 610 * @param { AsyncCallback<CameraStatusInfo> } callback - Callback used to get the camera status change. 611 * @syscap SystemCapability.Multimedia.Camera.Core 612 * @since 10 613 */ 614 on(type: 'cameraStatus', callback: AsyncCallback<CameraStatusInfo>): void; 615 616 /** 617 * Unsubscribes from camera status change event callback. 618 * 619 * @param { 'cameraStatus' } type - Event type. 620 * @param { AsyncCallback<CameraStatusInfo> } callback - Callback used to get the camera status change. 621 * @syscap SystemCapability.Multimedia.Camera.Core 622 * @since 10 623 */ 624 off(type: 'cameraStatus', callback?: AsyncCallback<CameraStatusInfo>): void; 625 626 /** 627 * Subscribes camera mute change event callback. 628 * 629 * @param { 'cameraMute' } type - Event type. 630 * @param { AsyncCallback<boolean> } callback - Callback used to get the camera mute change. 631 * @syscap SystemCapability.Multimedia.Camera.Core 632 * @systemapi 633 * @since 10 634 */ 635 on(type: 'cameraMute', callback: AsyncCallback<boolean>): void; 636 637 /** 638 * Unsubscribes from camera mute change event callback. 639 * 640 * @param { 'cameraMute' } type - Event type. 641 * @param { AsyncCallback<boolean> } callback - Callback used to get the camera mute change. 642 * @syscap SystemCapability.Multimedia.Camera.Core 643 * @systemapi 644 * @since 10 645 */ 646 off(type: 'cameraMute', callback?: AsyncCallback<boolean>): void; 647 648 /** 649 * Determines whether the camera device supports prelaunch. 650 * This function must be called in prior to the setPrelaunchConfig and prelaunch functions. 651 * 652 * @param { CameraDevice } camera - Camera device. 653 * @returns { boolean } Whether prelaunch is supported. 654 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 655 * @syscap SystemCapability.Multimedia.Camera.Core 656 * @systemapi 657 * @since 10 658 */ 659 isPrelaunchSupported(camera: CameraDevice): boolean; 660 661 /** 662 * Sets the camera prelaunch configuration. 663 * The configuration is sent to the camera service when you exit the camera or change the configuration next time. 664 * 665 * @permission ohos.permission.CAMERA 666 * @param { PrelaunchConfig } prelaunchConfig - Prelaunch configuration info. 667 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 668 * @throws { BusinessError } 7400102 - Operation not allowed. 669 * @syscap SystemCapability.Multimedia.Camera.Core 670 * @systemapi 671 * @since 10 672 */ 673 setPrelaunchConfig(prelaunchConfig: PrelaunchConfig): void; 674 675 /** 676 * Enable the camera to prelaunch and start. 677 * This function is called when the user clicks the system camera icon to start the camera application. 678 * 679 * @syscap SystemCapability.Multimedia.Camera.Core 680 * @systemapi 681 * @since 10 682 */ 683 prelaunch(): void; 684 685 /** 686 * Prepare the camera resources. 687 * This function is called when the user touch down the camera switch icon in camera application. 688 * 689 * @syscap SystemCapability.Multimedia.Camera.Core 690 * @systemapi 691 * @since 11 692 */ 693 preSwtichCamera(cameraId: string): void; 694 695 /** 696 * Creates a deferred PreviewOutput instance. 697 * 698 * @param { Profile } profile - Preview output profile. 699 * @returns { PreviewOutput } the PreviewOutput instance. 700 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 701 * @syscap SystemCapability.Multimedia.Camera.Core 702 * @systemapi 703 * @since 10 704 */ 705 createDeferredPreviewOutput(profile: Profile): PreviewOutput; 706 707 /** 708 * Check if the device has a torch. 709 * 710 * @return { boolean } this value that specifies whether the device has a torch. 711 * @syscap SystemCapability.Multimedia.Camera.Core 712 * @since 11 713 */ 714 isTorchSupported(): boolean; 715 716 /** 717 * Check if a specifies torch mode is supported. 718 * @param { TorchMode } mode torch mode. 719 * @return { boolean } is torch mode supported. 720 * @syscap SystemCapability.Multimedia.Camera.Core 721 * @since 11 722 */ 723 isTorchModeSupported(mode: TorchMode): boolean; 724 725 /** 726 * Get current torch mode. 727 * 728 * @return { boolean } torch mode. 729 * @syscap SystemCapability.Multimedia.Camera.Core 730 * @since 11 731 */ 732 getTorchMode(): TorchMode; 733 734 /** 735 * Set torch mode to the device. 736 * 737 * @param { TorchMode } mode torch mode. 738 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 739 * @syscap SystemCapability.Multimedia.Camera.Core 740 * @since 11 741 */ 742 setTorchMode(mode: TorchMode): void; 743 744 /** 745 * Subscribes torch status change event callback. 746 * 747 * @param { 'torchStatusChange' } type Event type 748 * @param { AsyncCallback<TorchStatusInfo> } callback Callback used to return the torch state change 749 * @syscap SystemCapability.Multimedia.Camera.Core 750 * @since 11 751 */ 752 on(type: 'torchStatusChange', callback: AsyncCallback<TorchStatusInfo>): void; 753 754 /** 755 * Unsubscribes torch status change event callback. 756 * 757 * @param { 'torchStatusChange' } type Event type 758 * @param { AsyncCallback<TorchStatusInfo> } callback Callback used to return the torch state change 759 * @syscap SystemCapability.Multimedia.Camera.Core 760 * @since 11 761 */ 762 off(type: 'torchStatusChange', callback?: AsyncCallback<TorchStatusInfo>): void; 763 } 764 765 /** 766 * Torch status info. 767 * 768 * @typedef TorchStatusInfo 769 * @syscap SystemCapability.Multimedia.Camera.Core 770 * @since 11 771 */ 772 interface TorchStatusInfo { 773 /** 774 * is torch available 775 * 776 * @type { boolean } 777 * @syscap SystemCapability.Multimedia.Camera.Core 778 * @since 11 779 */ 780 readonly isTorchAvailable: boolean; 781 782 /** 783 * is torch active 784 * 785 * @type { boolean } 786 * @syscap SystemCapability.Multimedia.Camera.Core 787 * @since 11 788 */ 789 readonly isTorchActive: boolean; 790 791 /** 792 * the current torch brightness level. 793 * 794 * @type { number } 795 * @syscap SystemCapability.Multimedia.Camera.Core 796 * @since 11 797 */ 798 readonly torchLevel: number; 799 } 800 801 /** 802 * Enum for torch mode. 803 * 804 * @enum { number } 805 * @syscap SystemCapability.Multimedia.Camera.Core 806 * @since 11 807 */ 808 enum TorchMode { 809 /** 810 * The device torch is always off. 811 * 812 * @syscap SystemCapability.Multimedia.Camera.Core 813 * @since 11 814 */ 815 OFF = 0, 816 817 /** 818 * The device torch is always on. 819 * 820 * @syscap SystemCapability.Multimedia.Camera.Core 821 * @since 11 822 */ 823 ON = 1, 824 825 /** 826 * The device continuously monitors light levels and uses the torch when necessary. 827 * 828 * @syscap SystemCapability.Multimedia.Camera.Core 829 * @since 11 830 */ 831 AUTO = 2 832 } 833 834 /** 835 * Camera status info. 836 * 837 * @typedef CameraStatusInfo 838 * @syscap SystemCapability.Multimedia.Camera.Core 839 * @since 10 840 */ 841 interface CameraStatusInfo { 842 /** 843 * Camera instance. 844 * 845 * @type { CameraDevice } 846 * @syscap SystemCapability.Multimedia.Camera.Core 847 * @since 10 848 */ 849 camera: CameraDevice; 850 851 /** 852 * Current camera status. 853 * 854 * @type { CameraStatus } 855 * @syscap SystemCapability.Multimedia.Camera.Core 856 * @since 10 857 */ 858 status: CameraStatus; 859 } 860 861 /** 862 * Enum for camera position. 863 * 864 * @enum { number } 865 * @syscap SystemCapability.Multimedia.Camera.Core 866 * @since 10 867 */ 868 enum CameraPosition { 869 /** 870 * Unspecified position. 871 * 872 * @syscap SystemCapability.Multimedia.Camera.Core 873 * @since 10 874 */ 875 CAMERA_POSITION_UNSPECIFIED = 0, 876 877 /** 878 * Back position. 879 * 880 * @syscap SystemCapability.Multimedia.Camera.Core 881 * @since 10 882 */ 883 CAMERA_POSITION_BACK = 1, 884 885 /** 886 * Front position. 887 * 888 * @syscap SystemCapability.Multimedia.Camera.Core 889 * @since 10 890 */ 891 CAMERA_POSITION_FRONT = 2, 892 893 /** 894 * Camera that is inner position when the device is folded. 895 * 896 * @syscap SystemCapability.Multimedia.Camera.Core 897 * @since 11 898 */ 899 CAMERA_POSITION_FOLD_INNER = 3 900 } 901 902 /** 903 * Enum for camera type. 904 * 905 * @enum { number } 906 * @syscap SystemCapability.Multimedia.Camera.Core 907 * @since 10 908 */ 909 enum CameraType { 910 /** 911 * Default camera type 912 * 913 * @syscap SystemCapability.Multimedia.Camera.Core 914 * @since 10 915 */ 916 CAMERA_TYPE_DEFAULT = 0 917 } 918 919 /** 920 * Enum for camera connection type. 921 * 922 * @enum { number } 923 * @syscap SystemCapability.Multimedia.Camera.Core 924 * @since 10 925 */ 926 enum ConnectionType { 927 /** 928 * Built-in camera. 929 * 930 * @syscap SystemCapability.Multimedia.Camera.Core 931 * @since 10 932 */ 933 CAMERA_CONNECTION_BUILT_IN = 0, 934 935 /** 936 * Camera connected using USB 937 * 938 * @syscap SystemCapability.Multimedia.Camera.Core 939 * @since 10 940 */ 941 CAMERA_CONNECTION_USB_PLUGIN = 1, 942 943 /** 944 * Remote camera 945 * 946 * @syscap SystemCapability.Multimedia.Camera.Core 947 * @since 10 948 */ 949 CAMERA_CONNECTION_REMOTE = 2 950 } 951 952 /** 953 * Enum for remote camera device type. 954 * 955 * @enum { number } 956 * @syscap SystemCapability.Multimedia.Camera.Core 957 * @systemapi 958 * @since 10 959 */ 960 enum HostDeviceType { 961 /** 962 * Indicates an unknown device camera. 963 * 964 * @syscap SystemCapability.Multimedia.Camera.Core 965 * @systemapi 966 * @since 10 967 */ 968 UNKNOWN_TYPE = 0, 969 970 /** 971 * Indicates a smartphone camera. 972 * 973 * @syscap SystemCapability.Multimedia.Camera.Core 974 * @systemapi 975 * @since 10 976 */ 977 PHONE = 0x0E, 978 979 /** 980 * Indicates a tablet camera. 981 * 982 * @syscap SystemCapability.Multimedia.Camera.Core 983 * @systemapi 984 * @since 10 985 */ 986 TABLET = 0x11 987 } 988 989 /** 990 * Camera device object. 991 * 992 * @typedef CameraDevice 993 * @syscap SystemCapability.Multimedia.Camera.Core 994 * @since 10 995 */ 996 interface CameraDevice { 997 /** 998 * Camera id attribute. 999 * 1000 * @type { string } 1001 * @readonly 1002 * @syscap SystemCapability.Multimedia.Camera.Core 1003 * @since 10 1004 */ 1005 readonly cameraId: string; 1006 1007 /** 1008 * Camera position attribute. 1009 * 1010 * @type { CameraPosition } 1011 * @readonly 1012 * @syscap SystemCapability.Multimedia.Camera.Core 1013 * @since 10 1014 */ 1015 readonly cameraPosition: CameraPosition; 1016 1017 /** 1018 * Camera type attribute. 1019 * 1020 * @type { CameraType } 1021 * @readonly 1022 * @syscap SystemCapability.Multimedia.Camera.Core 1023 * @since 10 1024 */ 1025 readonly cameraType: CameraType; 1026 1027 /** 1028 * Camera connection type attribute. 1029 * 1030 * @type { ConnectionType } 1031 * @readonly 1032 * @syscap SystemCapability.Multimedia.Camera.Core 1033 * @since 10 1034 */ 1035 readonly connectionType: ConnectionType; 1036 1037 /** 1038 * Camera remote camera device name attribute. 1039 * 1040 * @type { string } 1041 * @readonly 1042 * @syscap SystemCapability.Multimedia.Camera.Core 1043 * @systemapi 1044 * @since 10 1045 */ 1046 readonly hostDeviceName: string; 1047 1048 /** 1049 * Camera remote camera device type attribute. 1050 * 1051 * @type { HostDeviceType } 1052 * @readonly 1053 * @syscap SystemCapability.Multimedia.Camera.Core 1054 * @systemapi 1055 * @since 10 1056 */ 1057 readonly hostDeviceType: HostDeviceType; 1058 } 1059 1060 /** 1061 * Size parameter. 1062 * 1063 * @typedef Size 1064 * @syscap SystemCapability.Multimedia.Camera.Core 1065 * @since 10 1066 */ 1067 interface Size { 1068 /** 1069 * Height. 1070 * 1071 * @type { number } 1072 * @syscap SystemCapability.Multimedia.Camera.Core 1073 * @since 10 1074 */ 1075 height: number; 1076 1077 /** 1078 * Width. 1079 * 1080 * @type { number } 1081 * @syscap SystemCapability.Multimedia.Camera.Core 1082 * @since 10 1083 */ 1084 width: number; 1085 } 1086 1087 /** 1088 * Point parameter. 1089 * 1090 * @typedef Point 1091 * @syscap SystemCapability.Multimedia.Camera.Core 1092 * @since 10 1093 */ 1094 interface Point { 1095 /** 1096 * x co-ordinate 1097 * 1098 * @type { number } 1099 * @syscap SystemCapability.Multimedia.Camera.Core 1100 * @since 10 1101 */ 1102 x: number; 1103 1104 /** 1105 * y co-ordinate 1106 * 1107 * @type { number } 1108 * @syscap SystemCapability.Multimedia.Camera.Core 1109 * @since 10 1110 */ 1111 y: number; 1112 } 1113 1114 /** 1115 * Camera input object. 1116 * 1117 * @interface CameraInput 1118 * @syscap SystemCapability.Multimedia.Camera.Core 1119 * @since 10 1120 */ 1121 interface CameraInput { 1122 /** 1123 * Open camera. 1124 * 1125 * @param { AsyncCallback<void> } callback - Callback used to return the result. 1126 * @throws { BusinessError } 7400107 - Can not use camera cause of conflict. 1127 * @throws { BusinessError } 7400108 - Camera disabled cause of security reason. 1128 * @throws { BusinessError } 7400201 - Camera service fatal error. 1129 * @syscap SystemCapability.Multimedia.Camera.Core 1130 * @since 10 1131 */ 1132 open(callback: AsyncCallback<void>): void; 1133 1134 /** 1135 * Open camera. 1136 * 1137 * @returns { Promise<void> } Promise used to return the result. 1138 * @throws { BusinessError } 7400107 - Can not use camera cause of conflict. 1139 * @throws { BusinessError } 7400108 - Camera disabled cause of security reason. 1140 * @throws { BusinessError } 7400201 - Camera service fatal error. 1141 * @syscap SystemCapability.Multimedia.Camera.Core 1142 * @since 10 1143 */ 1144 open(): Promise<void>; 1145 1146 /** 1147 * Close camera. 1148 * 1149 * @param { AsyncCallback<void> } callback - Callback used to return the result. 1150 * @throws { BusinessError } 7400201 - Camera service fatal error. 1151 * @syscap SystemCapability.Multimedia.Camera.Core 1152 * @since 10 1153 */ 1154 close(callback: AsyncCallback<void>): void; 1155 1156 /** 1157 * Close camera. 1158 * 1159 * @returns { Promise<void> } Promise used to return the result. 1160 * @throws { BusinessError } 7400201 - Camera service fatal error. 1161 * @syscap SystemCapability.Multimedia.Camera.Core 1162 * @since 10 1163 */ 1164 close(): Promise<void>; 1165 1166 /** 1167 * Subscribes to error events. 1168 * 1169 * @param { 'error' } type - Event type. 1170 * @param { CameraDevice } camera - Camera device. 1171 * @param { ErrorCallback } callback - Callback used to get the camera input errors. 1172 * @syscap SystemCapability.Multimedia.Camera.Core 1173 * @since 10 1174 */ 1175 on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; 1176 1177 /** 1178 * Unsubscribes from error events. 1179 * 1180 * @param { 'error' } type - Event type. 1181 * @param { CameraDevice } camera - Camera device. 1182 * @param { ErrorCallback } callback - Callback used to get the camera input errors. 1183 * @syscap SystemCapability.Multimedia.Camera.Core 1184 * @since 10 1185 */ 1186 off(type: 'error', camera: CameraDevice, callback?: ErrorCallback): void; 1187 } 1188 1189 /** 1190 * Enumerates the camera scene modes. 1191 * 1192 * @enum { number } 1193 * @syscap SystemCapability.Multimedia.Camera.Core 1194 * @since 11 1195 */ 1196 enum SceneMode { 1197 /** 1198 * Normal photo mode. 1199 * 1200 * @syscap SystemCapability.Multimedia.Camera.Core 1201 * @since 11 1202 */ 1203 NORMAL_PHOTO = 1, 1204 1205 /** 1206 * Normal video mode. 1207 * 1208 * @syscap SystemCapability.Multimedia.Camera.Core 1209 * @since 11 1210 */ 1211 NORMAL_VIDEO = 2, 1212 1213 /** 1214 * Portrait photo mode. 1215 * 1216 * @syscap SystemCapability.Multimedia.Camera.Core 1217 * @systemapi 1218 * @since 11 1219 */ 1220 PORTRAIT_PHOTO = 3, 1221 1222 /** 1223 * Night photo mode. 1224 * 1225 * @syscap SystemCapability.Multimedia.Camera.Core 1226 * @systemapi 1227 * @since 11 1228 */ 1229 NIGHT_PHOTO = 4 1230 } 1231 1232 /** 1233 * Enum for camera format type. 1234 * 1235 * @enum { number } 1236 * @syscap SystemCapability.Multimedia.Camera.Core 1237 * @since 10 1238 */ 1239 enum CameraFormat { 1240 /** 1241 * RGBA 8888 Format. 1242 * 1243 * @syscap SystemCapability.Multimedia.Camera.Core 1244 * @since 10 1245 */ 1246 CAMERA_FORMAT_RGBA_8888 = 3, 1247 1248 /** 1249 * YUV 420 Format. 1250 * 1251 * @syscap SystemCapability.Multimedia.Camera.Core 1252 * @since 10 1253 */ 1254 CAMERA_FORMAT_YUV_420_SP = 1003, 1255 1256 /** 1257 * JPEG Format. 1258 * 1259 * @syscap SystemCapability.Multimedia.Camera.Core 1260 * @since 10 1261 */ 1262 CAMERA_FORMAT_JPEG = 2000, 1263 1264 /** 1265 * YCBCR P010 Format. 1266 * 1267 * @syscap SystemCapability.Multimedia.Camera.Core 1268 * @since 11 1269 */ 1270 CAMERA_FORMAT_YCBCR_P010, 1271 1272 /** 1273 * YCRCB P010 Format. 1274 * 1275 * @syscap SystemCapability.Multimedia.Camera.Core 1276 * @since 11 1277 */ 1278 CAMERA_FORMAT_YCRCB_P010 1279 } 1280 1281 /** 1282 * Enum for flash mode. 1283 * 1284 * @enum { number } 1285 * @syscap SystemCapability.Multimedia.Camera.Core 1286 * @since 10 1287 */ 1288 enum FlashMode { 1289 /** 1290 * Close mode. 1291 * 1292 * @syscap SystemCapability.Multimedia.Camera.Core 1293 * @since 10 1294 */ 1295 FLASH_MODE_CLOSE = 0, 1296 1297 /** 1298 * Open mode. 1299 * 1300 * @syscap SystemCapability.Multimedia.Camera.Core 1301 * @since 10 1302 */ 1303 FLASH_MODE_OPEN = 1, 1304 1305 /** 1306 * Auto mode. 1307 * 1308 * @syscap SystemCapability.Multimedia.Camera.Core 1309 * @since 10 1310 */ 1311 FLASH_MODE_AUTO = 2, 1312 1313 /** 1314 * Always open mode. 1315 * 1316 * @syscap SystemCapability.Multimedia.Camera.Core 1317 * @since 10 1318 */ 1319 FLASH_MODE_ALWAYS_OPEN = 3 1320 } 1321 1322 /** 1323 * Flash object. 1324 * 1325 * @interface Flash 1326 * @syscap SystemCapability.Multimedia.Camera.Core 1327 * @since 11 1328 */ 1329 interface Flash { 1330 /** 1331 * Check if device has flash light. 1332 * 1333 * @returns { boolean } The flash light support status. 1334 * @throws { BusinessError } 7400103 - Session not config. 1335 * @syscap SystemCapability.Multimedia.Camera.Core 1336 * @since 10 1337 */ 1338 hasFlash(): boolean; 1339 1340 /** 1341 * Checks whether a specified flash mode is supported. 1342 * 1343 * @param { FlashMode } flashMode - Flash mode 1344 * @returns { boolean } Is the flash mode supported. 1345 * @throws { BusinessError } 7400103 - Session not config. 1346 * @syscap SystemCapability.Multimedia.Camera.Core 1347 * @since 10 1348 */ 1349 isFlashModeSupported(flashMode: FlashMode): boolean; 1350 1351 /** 1352 * Gets current flash mode. 1353 * 1354 * @returns { FlashMode } The current flash mode. 1355 * @throws { BusinessError } 7400103 - Session not config. 1356 * @syscap SystemCapability.Multimedia.Camera.Core 1357 * @since 10 1358 */ 1359 getFlashMode(): FlashMode; 1360 1361 /** 1362 * Sets flash mode. 1363 * 1364 * @param { FlashMode } flashMode - Target flash mode. 1365 * @throws { BusinessError } 7400103 - Session not config. 1366 * @syscap SystemCapability.Multimedia.Camera.Core 1367 * @since 10 1368 */ 1369 setFlashMode(flashMode: FlashMode): void; 1370 } 1371 1372 /** 1373 * Enum for exposure mode. 1374 * 1375 * @enum { number } 1376 * @syscap SystemCapability.Multimedia.Camera.Core 1377 * @since 10 1378 */ 1379 enum ExposureMode { 1380 /** 1381 * Lock exposure mode. 1382 * 1383 * @syscap SystemCapability.Multimedia.Camera.Core 1384 * @since 10 1385 */ 1386 EXPOSURE_MODE_LOCKED = 0, 1387 1388 /** 1389 * Auto exposure mode. 1390 * 1391 * @syscap SystemCapability.Multimedia.Camera.Core 1392 * @since 10 1393 */ 1394 EXPOSURE_MODE_AUTO = 1, 1395 1396 /** 1397 * Continuous automatic exposure. 1398 * 1399 * @syscap SystemCapability.Multimedia.Camera.Core 1400 * @since 10 1401 */ 1402 EXPOSURE_MODE_CONTINUOUS_AUTO = 2 1403 } 1404 1405 /** 1406 * AutoExposure object. 1407 * 1408 * @interface AutoExposure 1409 * @syscap SystemCapability.Multimedia.Camera.Core 1410 * @since 11 1411 */ 1412 interface AutoExposure { 1413 /** 1414 * Checks whether a specified exposure mode is supported. 1415 * 1416 * @param { ExposureMode } aeMode - Exposure mode 1417 * @returns { boolean } Is the exposure mode supported. 1418 * @throws { BusinessError } 7400103 - Session not config. 1419 * @syscap SystemCapability.Multimedia.Camera.Core 1420 * @since 10 1421 */ 1422 isExposureModeSupported(aeMode: ExposureMode): boolean; 1423 1424 /** 1425 * Gets current exposure mode. 1426 * 1427 * @returns { ExposureMode } The current exposure mode. 1428 * @throws { BusinessError } 7400103 - Session not config. 1429 * @syscap SystemCapability.Multimedia.Camera.Core 1430 * @since 10 1431 */ 1432 getExposureMode(): ExposureMode; 1433 1434 /** 1435 * Sets Exposure mode. 1436 * 1437 * @param { ExposureMode } aeMode - Exposure mode 1438 * @throws { BusinessError } 7400103 - Session not config. 1439 * @syscap SystemCapability.Multimedia.Camera.Core 1440 * @since 10 1441 */ 1442 setExposureMode(aeMode: ExposureMode): void; 1443 1444 /** 1445 * Gets current metering point. 1446 * 1447 * @returns { Point } The current metering point. 1448 * @throws { BusinessError } 7400103 - Session not config. 1449 * @syscap SystemCapability.Multimedia.Camera.Core 1450 * @since 10 1451 */ 1452 getMeteringPoint(): Point; 1453 1454 /** 1455 * Set the center point of the metering area. 1456 * 1457 * @param { Point } point - metering point 1458 * @throws { BusinessError } 7400103 - Session not config. 1459 * @syscap SystemCapability.Multimedia.Camera.Core 1460 * @since 10 1461 */ 1462 setMeteringPoint(point: Point): void; 1463 1464 /** 1465 * Query the exposure compensation range. 1466 * 1467 * @returns { Array<number> } The array of compensation range. 1468 * @throws { BusinessError } 7400103 - Session not config. 1469 * @syscap SystemCapability.Multimedia.Camera.Core 1470 * @since 10 1471 */ 1472 getExposureBiasRange(): Array<number>; 1473 1474 /** 1475 * Set exposure compensation. 1476 * 1477 * @param { number } exposureBias - Exposure compensation 1478 * @throws { BusinessError } 7400103 - Session not config. 1479 * @syscap SystemCapability.Multimedia.Camera.Core 1480 * @since 10 1481 */ 1482 setExposureBias(exposureBias: number): void; 1483 } 1484 1485 /** 1486 * Enum for focus mode. 1487 * 1488 * @enum { number } 1489 * @syscap SystemCapability.Multimedia.Camera.Core 1490 * @since 10 1491 */ 1492 enum FocusMode { 1493 /** 1494 * Manual mode. 1495 * 1496 * @syscap SystemCapability.Multimedia.Camera.Core 1497 * @since 10 1498 */ 1499 FOCUS_MODE_MANUAL = 0, 1500 1501 /** 1502 * Continuous auto mode. 1503 * 1504 * @syscap SystemCapability.Multimedia.Camera.Core 1505 * @since 10 1506 */ 1507 FOCUS_MODE_CONTINUOUS_AUTO = 1, 1508 1509 /** 1510 * Auto mode. 1511 * 1512 * @syscap SystemCapability.Multimedia.Camera.Core 1513 * @since 10 1514 */ 1515 FOCUS_MODE_AUTO = 2, 1516 1517 /** 1518 * Locked mode. 1519 * 1520 * @syscap SystemCapability.Multimedia.Camera.Core 1521 * @since 10 1522 */ 1523 FOCUS_MODE_LOCKED = 3 1524 } 1525 1526 /** 1527 * Enum for focus state. 1528 * 1529 * @enum { number } 1530 * @syscap SystemCapability.Multimedia.Camera.Core 1531 * @since 10 1532 */ 1533 enum FocusState { 1534 /** 1535 * Scan state. 1536 * 1537 * @syscap SystemCapability.Multimedia.Camera.Core 1538 * @since 10 1539 */ 1540 FOCUS_STATE_SCAN = 0, 1541 1542 /** 1543 * Focused state. 1544 * 1545 * @syscap SystemCapability.Multimedia.Camera.Core 1546 * @since 10 1547 */ 1548 FOCUS_STATE_FOCUSED = 1, 1549 1550 /** 1551 * Unfocused state. 1552 * 1553 * @syscap SystemCapability.Multimedia.Camera.Core 1554 * @since 10 1555 */ 1556 FOCUS_STATE_UNFOCUSED = 2 1557 } 1558 1559 /** 1560 * Focus object. 1561 * 1562 * @interface Focus 1563 * @syscap SystemCapability.Multimedia.Camera.Core 1564 * @since 11 1565 */ 1566 interface Focus { 1567 /** 1568 * Checks whether a specified focus mode is supported. 1569 * 1570 * @param { FocusMode } afMode - Focus mode. 1571 * @returns { boolean } Is the focus mode supported. 1572 * @throws { BusinessError } 7400103 - Session not config. 1573 * @syscap SystemCapability.Multimedia.Camera.Core 1574 * @since 10 1575 */ 1576 isFocusModeSupported(afMode: FocusMode): boolean; 1577 1578 /** 1579 * Gets current focus mode. 1580 * 1581 * @returns { FocusMode } The current focus mode. 1582 * @throws { BusinessError } 7400103 - Session not config. 1583 * @syscap SystemCapability.Multimedia.Camera.Core 1584 * @since 10 1585 */ 1586 getFocusMode(): FocusMode; 1587 1588 /** 1589 * Sets focus mode. 1590 * 1591 * @param { FocusMode } afMode - Target focus mode. 1592 * @throws { BusinessError } 7400103 - Session not config. 1593 * @syscap SystemCapability.Multimedia.Camera.Core 1594 * @since 10 1595 */ 1596 setFocusMode(afMode: FocusMode): void; 1597 1598 /** 1599 * Sets focus point. 1600 * 1601 * @param { Point } point - Target focus point. 1602 * @throws { BusinessError } 7400103 - Session not config. 1603 * @syscap SystemCapability.Multimedia.Camera.Core 1604 * @since 10 1605 */ 1606 setFocusPoint(point: Point): void; 1607 1608 /** 1609 * Gets current focus point. 1610 * 1611 * @returns { Point } The current focus point. 1612 * @throws { BusinessError } 7400103 - Session not config. 1613 * @syscap SystemCapability.Multimedia.Camera.Core 1614 * @since 10 1615 */ 1616 getFocusPoint(): Point; 1617 1618 /** 1619 * Gets current focal length. 1620 * 1621 * @returns { number } The current focal point. 1622 * @throws { BusinessError } 7400103 - Session not config. 1623 * @syscap SystemCapability.Multimedia.Camera.Core 1624 * @since 10 1625 */ 1626 getFocalLength(): number; 1627 } 1628 1629 /** 1630 * Enum for smooth zoom mode. 1631 * 1632 * @enum { number } 1633 * @syscap SystemCapability.Multimedia.Camera.Core 1634 * @since 11 1635 */ 1636 enum SmoothZoomMode { 1637 /** 1638 * Normal zoom mode. 1639 * 1640 * @syscap SystemCapability.Multimedia.Camera.Core 1641 * @since 11 1642 */ 1643 NORMAL = 0 1644 } 1645 1646 /** 1647 * SmoothZoomInfo object 1648 * 1649 * @typedef SmoothZoomInfo 1650 * @syscap SystemCapability.Multimedia.Camera.Core 1651 * @since 11 1652 */ 1653 interface SmoothZoomInfo { 1654 /** 1655 * The duration of smooth zoom. 1656 * 1657 * @type { number } 1658 * @syscap SystemCapability.Multimedia.Camera.Core 1659 * @since 11 1660 */ 1661 duration: number; 1662 } 1663 1664 /** 1665 * Zoom object. 1666 * 1667 * @interface Zoom 1668 * @syscap SystemCapability.Multimedia.Camera.Core 1669 * @since 11 1670 */ 1671 interface Zoom { 1672 /** 1673 * Gets all supported zoom ratio range. 1674 * 1675 * @returns { Array<number> } The zoom ratio range. 1676 * @throws { BusinessError } 7400103 - Session not config. 1677 * @syscap SystemCapability.Multimedia.Camera.Core 1678 * @since 10 1679 */ 1680 getZoomRatioRange(): Array<number>; 1681 1682 /** 1683 * Gets zoom ratio. 1684 * 1685 * @returns { number } The zoom ratio value. 1686 * @throws { BusinessError } 7400103 - Session not config. 1687 * @syscap SystemCapability.Multimedia.Camera.Core 1688 * @since 10 1689 */ 1690 getZoomRatio(): number; 1691 1692 /** 1693 * Sets zoom ratio. 1694 * 1695 * @param { number } zoomRatio - Target zoom ratio. 1696 * @throws { BusinessError } 7400103 - Session not config. 1697 * @syscap SystemCapability.Multimedia.Camera.Core 1698 * @since 10 1699 */ 1700 setZoomRatio(zoomRatio: number): void; 1701 1702 /** 1703 * Sets target zoom ratio by smooth method. 1704 * 1705 * @param { number } targetRatio - Target zoom ratio. 1706 * @param { SmoothZoomMode } mode - Smooth zoom mode. 1707 * @throws { BusinessError } 7400103 - Session not config. 1708 * @syscap SystemCapability.Multimedia.Camera.Core 1709 * @since 11 1710 */ 1711 setSmoothZoom(targetRatio: number, mode?: SmoothZoomMode): void; 1712 1713 /** 1714 * Notify device to prepare for zoom. 1715 * 1716 * @throws { BusinessError } 7400103 - Session not config. 1717 * @syscap SystemCapability.Multimedia.Camera.Core 1718 * @systemapi 1719 * @since 11 1720 */ 1721 prepareZoom(): void; 1722 1723 /** 1724 * Notify device of zoom completion. 1725 * 1726 * @throws { BusinessError } 7400103 - Session not config. 1727 * @syscap SystemCapability.Multimedia.Camera.Core 1728 * @systemapi 1729 * @since 11 1730 */ 1731 unPrepareZoom(): void; 1732 } 1733 1734 /** 1735 * Enum for video stabilization mode. 1736 * 1737 * @enum { number } 1738 * @syscap SystemCapability.Multimedia.Camera.Core 1739 * @since 10 1740 */ 1741 enum VideoStabilizationMode { 1742 /** 1743 * Turn off video stablization. 1744 * 1745 * @syscap SystemCapability.Multimedia.Camera.Core 1746 * @since 10 1747 */ 1748 OFF = 0, 1749 1750 /** 1751 * LOW mode provides basic stabilization effect. 1752 * 1753 * @syscap SystemCapability.Multimedia.Camera.Core 1754 * @since 10 1755 */ 1756 LOW = 1, 1757 1758 /** 1759 * MIDDLE mode means algorithms can achieve better effects than LOW mode. 1760 * 1761 * @syscap SystemCapability.Multimedia.Camera.Core 1762 * @since 10 1763 */ 1764 MIDDLE = 2, 1765 1766 /** 1767 * HIGH mode means algorithms can achieve better effects than MIDDLE mode. 1768 * 1769 * @syscap SystemCapability.Multimedia.Camera.Core 1770 * @since 10 1771 */ 1772 HIGH = 3, 1773 1774 /** 1775 * Camera HDF can select mode automatically. 1776 * 1777 * @syscap SystemCapability.Multimedia.Camera.Core 1778 * @since 10 1779 */ 1780 AUTO = 4 1781 } 1782 1783 /** 1784 * Stabilization object. 1785 * 1786 * @interface Stabilization 1787 * @syscap SystemCapability.Multimedia.Camera.Core 1788 * @since 11 1789 */ 1790 interface Stabilization { 1791 /** 1792 * Check whether the specified video stabilization mode is supported. 1793 * 1794 * @param { VideoStabilizationMode } vsMode - Video Stabilization mode. 1795 * @returns { boolean } Is flash mode supported. 1796 * @throws { BusinessError } 7400103 - Session not config. 1797 * @syscap SystemCapability.Multimedia.Camera.Core 1798 * @since 10 1799 */ 1800 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean; 1801 1802 /** 1803 * Query the video stabilization mode currently in use. 1804 * 1805 * @returns { VideoStabilizationMode } The current video stabilization mode. 1806 * @throws { BusinessError } 7400103 - Session not config. 1807 * @syscap SystemCapability.Multimedia.Camera.Core 1808 * @since 10 1809 */ 1810 getActiveVideoStabilizationMode(): VideoStabilizationMode; 1811 1812 /** 1813 * Set video stabilization mode. 1814 * 1815 * @param { VideoStabilizationMode } mode - video stabilization mode to set. 1816 * @throws { BusinessError } 7400103 - Session not config. 1817 * @syscap SystemCapability.Multimedia.Camera.Core 1818 * @since 10 1819 */ 1820 setVideoStabilizationMode(mode: VideoStabilizationMode): void; 1821 } 1822 1823 /** 1824 * Enumerates the camera beauty effect types. 1825 * 1826 * @enum { number } 1827 * @syscap SystemCapability.Multimedia.Camera.Core 1828 * @systemapi 1829 * @since 10 1830 */ 1831 enum BeautyType { 1832 /** 1833 * Auto beauty type. 1834 * 1835 * @syscap SystemCapability.Multimedia.Camera.Core 1836 * @systemapi 1837 * @since 10 1838 */ 1839 AUTO = 0, 1840 1841 /** 1842 * Skin smooth beauty type. 1843 * 1844 * @syscap SystemCapability.Multimedia.Camera.Core 1845 * @systemapi 1846 * @since 10 1847 */ 1848 SKIN_SMOOTH = 1, 1849 1850 /** 1851 * Face slender beauty type. 1852 * 1853 * @syscap SystemCapability.Multimedia.Camera.Core 1854 * @systemapi 1855 * @since 10 1856 */ 1857 FACE_SLENDER = 2, 1858 1859 /** 1860 * Skin tone beauty type. 1861 * 1862 * @syscap SystemCapability.Multimedia.Camera.Core 1863 * @systemapi 1864 * @since 10 1865 */ 1866 SKIN_TONE = 3 1867 } 1868 1869 /** 1870 * Beauty object. 1871 * 1872 * @interface Beauty 1873 * @syscap SystemCapability.Multimedia.Camera.Core 1874 * @systemapi 1875 * @since 11 1876 */ 1877 interface Beauty { 1878 /** 1879 * Gets supported beauty effect types. 1880 * 1881 * @returns { Array<BeautyType> } List of beauty effect types. 1882 * @throws { BusinessError } 7400103 - Session not config. 1883 * @syscap SystemCapability.Multimedia.Camera.Core 1884 * @systemapi 1885 * @since 10 1886 */ 1887 getSupportedBeautyTypes(): Array<BeautyType>; 1888 1889 /** 1890 * Gets the specific beauty effect type range. 1891 * 1892 * @param { BeautyType } type - The type of beauty effect. 1893 * @returns { Array<number> } The array of the specific beauty effect range. 1894 * @throws { BusinessError } 7400103 - Session not config. 1895 * @syscap SystemCapability.Multimedia.Camera.Core 1896 * @systemapi 1897 * @since 10 1898 */ 1899 getSupportedBeautyRange(type: BeautyType): Array<number>; 1900 1901 /** 1902 * Gets the beauty effect in use. 1903 * 1904 * @param { BeautyType } type - The type of beauty effect. 1905 * @returns { number } the beauty effect in use. 1906 * @throws { BusinessError } 7400103 - Session not config. 1907 * @syscap SystemCapability.Multimedia.Camera.Core 1908 * @systemapi 1909 * @since 10 1910 */ 1911 getBeauty(type: BeautyType): number; 1912 1913 /** 1914 * Sets a beauty effect for a camera device. 1915 * 1916 * @param { BeautyType } type - The type of beauty effect. 1917 * @param { number } value The number of beauty effect. 1918 * @throws { BusinessError } 7400103 - Session not config. 1919 * @syscap SystemCapability.Multimedia.Camera.Core 1920 * @systemapi 1921 * @since 10 1922 */ 1923 setBeauty(type: BeautyType, value: number): void; 1924 } 1925 1926 /** 1927 * Enumerates the camera color effect types. 1928 * 1929 * @enum { number } 1930 * @syscap SystemCapability.Multimedia.Camera.Core 1931 * @systemapi 1932 * @since 11 1933 */ 1934 enum ColorEffectType { 1935 /** 1936 * Normal color effect type. 1937 * 1938 * @syscap SystemCapability.Multimedia.Camera.Core 1939 * @systemapi 1940 * @since 11 1941 */ 1942 NORMAL = 0, 1943 1944 /** 1945 * Bright color effect type. 1946 * 1947 * @syscap SystemCapability.Multimedia.Camera.Core 1948 * @systemapi 1949 * @since 11 1950 */ 1951 BRIGHT = 1, 1952 1953 /** 1954 * Soft color effect type. 1955 * 1956 * @syscap SystemCapability.Multimedia.Camera.Core 1957 * @systemapi 1958 * @since 11 1959 */ 1960 SOFT = 2 1961 } 1962 1963 /** 1964 * Color effect object. 1965 * 1966 * @interface ColorEffect 1967 * @syscap SystemCapability.Multimedia.Camera.Core 1968 * @systemapi 1969 * @since 11 1970 */ 1971 interface ColorEffect { 1972 /** 1973 * Gets supported color effect types. 1974 * 1975 * @returns { Array<ColorEffectType> } List of color effect types. 1976 * @throws { BusinessError } 7400103 - Session not config. 1977 * @syscap SystemCapability.Multimedia.Camera.Core 1978 * @systemapi 1979 * @since 11 1980 */ 1981 getSupportedColorEffects(): Array<ColorEffectType>; 1982 1983 /** 1984 * Gets the specific color effect type. 1985 * 1986 * @returns { ColorEffectType } The array of the specific color effect type. 1987 * @throws { BusinessError } 7400103 - Session not config. 1988 * @syscap SystemCapability.Multimedia.Camera.Core 1989 * @systemapi 1990 * @since 11 1991 */ 1992 getColorEffect(): ColorEffectType; 1993 1994 /** 1995 * Sets a color effect for a camera device. 1996 * 1997 * @param { ColorEffectType } type - The type of color effect. 1998 * @throws { BusinessError } 7400103 - Session not config. 1999 * @syscap SystemCapability.Multimedia.Camera.Core 2000 * @systemapi 2001 * @since 11 2002 */ 2003 setColorEffect(type: ColorEffectType): void; 2004 } 2005 2006 /** 2007 * Color Management object. 2008 * 2009 * @interface ColorManagement 2010 * @syscap SystemCapability.Multimedia.Camera.Core 2011 * @systemapi 2012 * @since 11 2013 */ 2014 interface ColorManagement { 2015 /** 2016 * Gets the specific color space type. 2017 * 2018 * @returns { colorSpaceManager.ColorSpace } Current color space. 2019 * @throws { BusinessError } 7400103 - Session not config. 2020 * @syscap SystemCapability.Multimedia.Camera.Core 2021 * @systemapi 2022 * @since 11 2023 */ 2024 getActiveColorSpace(): colorSpaceManager.ColorSpace; 2025 2026 /** 2027 * Gets the supported color space types. 2028 * 2029 * @returns { Array<colorSpaceManager.ColorSpace> } The array of the supported color space for the session. 2030 * @throws { BusinessError } 7400103 - Session not config. 2031 * @syscap SystemCapability.Multimedia.Camera.Core 2032 * @systemapi 2033 * @since 11 2034 */ 2035 getSupportedColorSpaces(): Array<colorSpaceManager.ColorSpace>; 2036 2037 /** 2038 * Sets a color space for the session. 2039 * 2040 * @param { colorSpaceManager.ColorSpace } colorSpace - The type of color space. 2041 * @throws { BusinessError } 7400103 - Session not config. 2042 * @syscap SystemCapability.Multimedia.Camera.Core 2043 * @systemapi 2044 * @since 11 2045 */ 2046 setColorSpace(colorSpace: colorSpaceManager.ColorSpace): void; 2047 } 2048 2049 /** 2050 * Macro object. 2051 * 2052 * @interface Macro 2053 * @syscap SystemCapability.Multimedia.Camera.Core 2054 * @systemapi 2055 * @since 11 2056 */ 2057 interface Macro { 2058 /** 2059 * Determine whether camera macro is supported. 2060 * 2061 * @returns { boolean } Is camera macro supported. 2062 * @syscap SystemCapability.Multimedia.Camera.Core 2063 * @systemapi 2064 * @since 11 2065 */ 2066 isMacroSupported(): boolean; 2067 2068 /** 2069 * Enable macro for camera. 2070 * 2071 * @param { boolean } enabled - enable macro for camera if TRUE. 2072 * @throws { BusinessError } 7400103 - Session not config. 2073 * @syscap SystemCapability.Multimedia.Camera.Core 2074 * @systemapi 2075 * @since 11 2076 */ 2077 enableMacro(enabled: boolean): void; 2078 } 2079 2080 /** 2081 * Session object. 2082 * 2083 * @interface Session 2084 * @syscap SystemCapability.Multimedia.Camera.Core 2085 * @since 11 2086 */ 2087 interface Session { 2088 /** 2089 * Begin capture session config. 2090 * 2091 * @throws { BusinessError } 7400105 - Session config locked. 2092 * @syscap SystemCapability.Multimedia.Camera.Core 2093 * @since 10 2094 */ 2095 beginConfig(): void; 2096 2097 /** 2098 * Commit capture session config. 2099 * 2100 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2101 * @throws { BusinessError } 7400102 - Operation not allowed. 2102 * @throws { BusinessError } 7400201 - Camera service fatal error. 2103 * @syscap SystemCapability.Multimedia.Camera.Core 2104 * @since 10 2105 */ 2106 commitConfig(callback: AsyncCallback<void>): void; 2107 2108 /** 2109 * Commit capture session config. 2110 * 2111 * @returns { Promise<void> } Promise used to return the result. 2112 * @throws { BusinessError } 7400102 - Operation not allowed. 2113 * @throws { BusinessError } 7400201 - Camera service fatal error. 2114 * @syscap SystemCapability.Multimedia.Camera.Core 2115 * @since 10 2116 */ 2117 commitConfig(): Promise<void>; 2118 2119 /** 2120 * Determines whether the camera input can be added into the session. 2121 * This method is valid between Session.beginConfig() and Session.commitConfig(). 2122 * 2123 * @param { CameraInput } cameraInput - Target camera input to add. 2124 * @returns { boolean } You can add the input into the session. 2125 * @syscap SystemCapability.Multimedia.Camera.Core 2126 * @since 11 2127 */ 2128 canAddInput(cameraInput: CameraInput): boolean; 2129 2130 /** 2131 * Adds a camera input. 2132 * This method is valid between Session.beginConfig() and Session.commitConfig(). 2133 * 2134 * @param { CameraInput } cameraInput - Target camera input to add. 2135 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 2136 * @throws { BusinessError } 7400102 - Operation not allowed. 2137 * @throws { BusinessError } 7400103 - Session not config. 2138 * @syscap SystemCapability.Multimedia.Camera.Core 2139 * @since 10 2140 */ 2141 addInput(cameraInput: CameraInput): void; 2142 2143 /** 2144 * Removes a camera input. 2145 * This method is valid between Session.beginConfig() and Session.commitConfig(). 2146 * 2147 * @param { CameraInput } cameraInput - Target camera input to remove. 2148 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 2149 * @throws { BusinessError } 7400102 - Operation not allowed. 2150 * @throws { BusinessError } 7400103 - Session not config. 2151 * @syscap SystemCapability.Multimedia.Camera.Core 2152 * @since 10 2153 */ 2154 removeInput(cameraInput: CameraInput): void; 2155 2156 /** 2157 * Determines whether the camera output can be added into the session. 2158 * This method is valid after Session.addInput(cameraInput) and before Session.commitConfig(). 2159 * 2160 * @param { CameraOutput } cameraOutput - Target camera output to add. 2161 * @returns { boolean } You can add the output into the session. 2162 * @syscap SystemCapability.Multimedia.Camera.Core 2163 * @since 11 2164 */ 2165 canAddOutput(cameraOutput: CameraOutput): boolean; 2166 2167 /** 2168 * Adds a camera output. 2169 * This method is valid after Session.addInput(cameraInput) and before Session.commitConfig(). 2170 * 2171 * @param { CameraOutput } cameraOutput - Target camera output to add. 2172 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 2173 * @throws { BusinessError } 7400102 - Operation not allowed. 2174 * @throws { BusinessError } 7400103 - Session not config. 2175 * @syscap SystemCapability.Multimedia.Camera.Core 2176 * @since 10 2177 */ 2178 addOutput(cameraOutput: CameraOutput): void; 2179 2180 /** 2181 * Removes a camera output. 2182 * This method is valid between Session.beginConfig() and Session.commitConfig(). 2183 * 2184 * @param { CameraOutput } cameraOutput - Target camera output to remove. 2185 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 2186 * @throws { BusinessError } 7400102 - Operation not allowed. 2187 * @throws { BusinessError } 7400103 - Session not config. 2188 * @syscap SystemCapability.Multimedia.Camera.Core 2189 * @since 10 2190 */ 2191 removeOutput(cameraOutput: CameraOutput): void; 2192 2193 /** 2194 * Starts capture session. 2195 * 2196 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2197 * @throws { BusinessError } 7400103 - Session not config. 2198 * @throws { BusinessError } 7400201 - Camera service fatal error. 2199 * @syscap SystemCapability.Multimedia.Camera.Core 2200 * @since 10 2201 */ 2202 start(callback: AsyncCallback<void>): void; 2203 2204 /** 2205 * Starts capture session. 2206 * 2207 * @returns { Promise<void> } Promise used to return the result. 2208 * @throws { BusinessError } 7400103 - Session not config. 2209 * @throws { BusinessError } 7400201 - Camera service fatal error. 2210 * @syscap SystemCapability.Multimedia.Camera.Core 2211 * @since 10 2212 */ 2213 start(): Promise<void>; 2214 2215 /** 2216 * Stops capture session. 2217 * 2218 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2219 * @throws { BusinessError } 7400201 - Camera service fatal error. 2220 * @syscap SystemCapability.Multimedia.Camera.Core 2221 * @since 10 2222 */ 2223 stop(callback: AsyncCallback<void>): void; 2224 2225 /** 2226 * Stops capture session. 2227 * 2228 * @returns { Promise<void> } Promise used to return the result. 2229 * @throws { BusinessError } 7400201 - Camera service fatal error. 2230 * @syscap SystemCapability.Multimedia.Camera.Core 2231 * @since 10 2232 */ 2233 stop(): Promise<void>; 2234 2235 /** 2236 * Release capture session instance. 2237 * 2238 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2239 * @throws { BusinessError } 7400201 - Camera service fatal error. 2240 * @syscap SystemCapability.Multimedia.Camera.Core 2241 * @since 10 2242 */ 2243 release(callback: AsyncCallback<void>): void; 2244 2245 /** 2246 * Release capture session instance. 2247 * 2248 * @returns { Promise<void> } Promise used to return the result. 2249 * @throws { BusinessError } 7400201 - Camera service fatal error. 2250 * @syscap SystemCapability.Multimedia.Camera.Core 2251 * @since 10 2252 */ 2253 release(): Promise<void>; 2254 } 2255 2256 /** 2257 * Capture session object. 2258 * 2259 * @interface CaptureSession 2260 * @syscap SystemCapability.Multimedia.Camera.Core 2261 * @deprecated since 11 2262 * @since 10 2263 */ 2264 interface CaptureSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty { 2265 /** 2266 * Subscribes to error events. 2267 * 2268 * @param { 'error' } type - Event type. 2269 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2270 * @syscap SystemCapability.Multimedia.Camera.Core 2271 * @since 10 2272 */ 2273 on(type: 'error', callback: ErrorCallback): void; 2274 2275 /** 2276 * Unsubscribes from error events. 2277 * 2278 * @param { 'error' } type - Event type. 2279 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2280 * @syscap SystemCapability.Multimedia.Camera.Core 2281 * @since 10 2282 */ 2283 off(type: 'error', callback?: ErrorCallback): void; 2284 2285 /** 2286 * Subscribes focus status change event callback. 2287 * 2288 * @param { 'focusStateChange' } type - Event type. 2289 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2290 * @syscap SystemCapability.Multimedia.Camera.Core 2291 * @since 10 2292 */ 2293 on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void; 2294 2295 /** 2296 * Unsubscribes from focus status change event callback. 2297 * 2298 * @param { 'focusStateChange' } type - Event type. 2299 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2300 * @syscap SystemCapability.Multimedia.Camera.Core 2301 * @since 10 2302 */ 2303 off(type: 'focusStateChange', callback?: AsyncCallback<FocusState>): void; 2304 2305 /** 2306 * Subscribes zoom info event callback. 2307 * 2308 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2309 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2310 * @syscap SystemCapability.Multimedia.Camera.Core 2311 * @since 11 2312 */ 2313 on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback<SmoothZoomInfo>): void; 2314 2315 /** 2316 * Unsubscribes from zoom info event callback. 2317 * 2318 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2319 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2320 * @syscap SystemCapability.Multimedia.Camera.Core 2321 * @since 11 2322 */ 2323 off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback<SmoothZoomInfo>): void; 2324 } 2325 2326 /** 2327 * Photo session object. 2328 * 2329 * @interface PhotoSession 2330 * @syscap SystemCapability.Multimedia.Camera.Core 2331 * @since 11 2332 */ 2333 interface PhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty, ColorEffect, ColorManagement, Macro { 2334 /** 2335 * Subscribes to error events. 2336 * 2337 * @param { 'error' } type - Event type. 2338 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2339 * @syscap SystemCapability.Multimedia.Camera.Core 2340 * @since 10 2341 */ 2342 on(type: 'error', callback: ErrorCallback): void; 2343 2344 /** 2345 * Unsubscribes from error events. 2346 * 2347 * @param { 'error' } type - Event type. 2348 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2349 * @syscap SystemCapability.Multimedia.Camera.Core 2350 * @since 10 2351 */ 2352 off(type: 'error', callback?: ErrorCallback): void; 2353 2354 /** 2355 * Subscribes focus status change event callback. 2356 * 2357 * @param { 'focusStateChange' } type - Event type. 2358 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2359 * @syscap SystemCapability.Multimedia.Camera.Core 2360 * @since 10 2361 */ 2362 on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void; 2363 2364 /** 2365 * Unsubscribes from focus status change event callback. 2366 * 2367 * @param { 'focusStateChange' } type - Event type. 2368 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2369 * @syscap SystemCapability.Multimedia.Camera.Core 2370 * @since 10 2371 */ 2372 off(type: 'focusStateChange', callback?: AsyncCallback<FocusState>): void; 2373 2374 /** 2375 * Subscribes zoom info event callback. 2376 * 2377 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2378 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2379 * @syscap SystemCapability.Multimedia.Camera.Core 2380 * @since 11 2381 */ 2382 on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback<SmoothZoomInfo>): void; 2383 2384 /** 2385 * Unsubscribes from zoom info event callback. 2386 * 2387 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2388 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2389 * @syscap SystemCapability.Multimedia.Camera.Core 2390 * @since 11 2391 */ 2392 off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback<SmoothZoomInfo>): void; 2393 2394 /** 2395 * Subscribes camera macro status event callback. 2396 * 2397 * @param { 'macroStatusChanged' } type - Event type. 2398 * @param { AsyncCallback<boolean> } callback - Callback used to return the result. 2399 * @syscap SystemCapability.Multimedia.Camera.Core 2400 * @systemapi 2401 * @since 11 2402 */ 2403 on(type: 'macroStatusChanged', callback: AsyncCallback<boolean>): void; 2404 2405 /** 2406 * Unsubscribes camera macro status event callback. 2407 * 2408 * @param { 'macroStatusChanged' } type - Event type. 2409 * @param { AsyncCallback<boolean> } callback - Callback used to return the result. 2410 * @syscap SystemCapability.Multimedia.Camera.Core 2411 * @systemapi 2412 * @since 11 2413 */ 2414 off(type: 'macroStatusChanged', callback?: AsyncCallback<boolean>): void; 2415 } 2416 2417 /** 2418 * Video session object. 2419 * 2420 * @interface VideoSession 2421 * @syscap SystemCapability.Multimedia.Camera.Core 2422 * @since 11 2423 */ 2424 interface VideoSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty, ColorEffect, ColorManagement, Macro, Stabilization { 2425 /** 2426 * Subscribes to error events. 2427 * 2428 * @param { 'error' } type - Event type. 2429 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2430 * @syscap SystemCapability.Multimedia.Camera.Core 2431 * @since 10 2432 */ 2433 on(type: 'error', callback: ErrorCallback): void; 2434 2435 /** 2436 * Unsubscribes from error events. 2437 * 2438 * @param { 'error' } type - Event type. 2439 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2440 * @syscap SystemCapability.Multimedia.Camera.Core 2441 * @since 10 2442 */ 2443 off(type: 'error', callback?: ErrorCallback): void; 2444 2445 /** 2446 * Subscribes focus status change event callback. 2447 * 2448 * @param { 'focusStateChange' } type - Event type. 2449 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2450 * @syscap SystemCapability.Multimedia.Camera.Core 2451 * @since 10 2452 */ 2453 on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void; 2454 2455 /** 2456 * Unsubscribes from focus status change event callback. 2457 * 2458 * @param { 'focusStateChange' } type - Event type. 2459 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2460 * @syscap SystemCapability.Multimedia.Camera.Core 2461 * @since 10 2462 */ 2463 off(type: 'focusStateChange', callback?: AsyncCallback<FocusState>): void; 2464 2465 /** 2466 * Subscribes zoom info event callback. 2467 * 2468 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2469 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2470 * @syscap SystemCapability.Multimedia.Camera.Core 2471 * @since 11 2472 */ 2473 on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback<SmoothZoomInfo>): void; 2474 2475 /** 2476 * Unsubscribes from zoom info event callback. 2477 * 2478 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2479 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2480 * @syscap SystemCapability.Multimedia.Camera.Core 2481 * @since 11 2482 */ 2483 off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback<SmoothZoomInfo>): void; 2484 2485 /** 2486 * Subscribes camera macro status event callback. 2487 * 2488 * @param { 'macroStatusChanged' } type - Event type. 2489 * @param { AsyncCallback<boolean> } callback - Callback used to return the result. 2490 * @syscap SystemCapability.Multimedia.Camera.Core 2491 * @systemapi 2492 * @since 11 2493 */ 2494 on(type: 'macroStatusChanged', callback: AsyncCallback<boolean>): void; 2495 2496 /** 2497 * Unsubscribes camera macro status event callback. 2498 * 2499 * @param { 'macroStatusChanged' } type - Event type. 2500 * @param { AsyncCallback<boolean> } callback - Callback used to return the result. 2501 * @syscap SystemCapability.Multimedia.Camera.Core 2502 * @systemapi 2503 * @since 11 2504 */ 2505 off(type: 'macroStatusChanged', callback?: AsyncCallback<boolean>): void; 2506 } 2507 2508 /** 2509 * Enumerates the camera portrait effects. 2510 * 2511 * @enum { number } 2512 * @syscap SystemCapability.Multimedia.Camera.Core 2513 * @systemapi 2514 * @since 10 2515 */ 2516 enum PortraitEffect { 2517 /** 2518 * portrait effect off. 2519 * 2520 * @syscap SystemCapability.Multimedia.Camera.Core 2521 * @systemapi 2522 * @since 10 2523 */ 2524 OFF = 0, 2525 2526 /** 2527 * circular blurring for portrait. 2528 * 2529 * @syscap SystemCapability.Multimedia.Camera.Core 2530 * @systemapi 2531 * @since 10 2532 */ 2533 CIRCLES = 1, 2534 2535 /** 2536 * heart blurring for portrait. 2537 * 2538 * @syscap SystemCapability.Multimedia.Camera.Core 2539 * @systemapi 2540 * @since 11 2541 */ 2542 HEART = 2, 2543 2544 /** 2545 * rotated blurring for portrait. 2546 * 2547 * @syscap SystemCapability.Multimedia.Camera.Core 2548 * @systemapi 2549 * @since 11 2550 */ 2551 ROTATED = 3, 2552 2553 /** 2554 * studio blurring for portrait. 2555 * 2556 * @syscap SystemCapability.Multimedia.Camera.Core 2557 * @systemapi 2558 * @since 11 2559 */ 2560 STUDIO = 4, 2561 2562 /** 2563 * theator blurring for portrait. 2564 * 2565 * @syscap SystemCapability.Multimedia.Camera.Core 2566 * @systemapi 2567 * @since 11 2568 */ 2569 THEATOR = 5 2570 } 2571 2572 /** 2573 * Portrait object. 2574 * 2575 * @interface Portrait 2576 * @syscap SystemCapability.Multimedia.Camera.Core 2577 * @systemapi 2578 * @since 11 2579 */ 2580 interface Portrait { 2581 /** 2582 * Gets supported portrait effect. 2583 * 2584 * @returns { Array<PortraitEffect> } List of portrait effect. 2585 * @throws { BusinessError } 7400103 - Session not config. 2586 * @syscap SystemCapability.Multimedia.Camera.Core 2587 * @systemapi 2588 * @since 10 2589 */ 2590 getSupportedPortraitEffects(): Array<PortraitEffect>; 2591 2592 /** 2593 * Gets the portrait effect in use. 2594 * 2595 * @returns { PortraitEffect } The portrait effect in use. 2596 * @throws { BusinessError } 7400103 - Session not config. 2597 * @syscap SystemCapability.Multimedia.Camera.Core 2598 * @systemapi 2599 * @since 10 2600 */ 2601 getPortraitEffect(): PortraitEffect; 2602 2603 /** 2604 * Sets a portrait effect for a camera device. 2605 * 2606 * @param { PortraitEffect } effect - Effect Portrait effect to set. 2607 * @throws { BusinessError } 7400103 - Session not config. 2608 * @syscap SystemCapability.Multimedia.Camera.Core 2609 * @systemapi 2610 * @since 10 2611 */ 2612 setPortraitEffect(effect: PortraitEffect): void; 2613 } 2614 2615 /** 2616 * Zoom range. 2617 * 2618 * @typedef ZoomRange 2619 * @syscap SystemCapability.Multimedia.Camera.Core 2620 * @systemapi 2621 * @since 11 2622 */ 2623 interface ZoomRange { 2624 /** 2625 * Min zoom value. 2626 * 2627 * @type { number } 2628 * @readonly 2629 * @syscap SystemCapability.Multimedia.Camera.Core 2630 * @systemapi 2631 * @since 11 2632 */ 2633 readonly min: number; 2634 2635 /** 2636 * Max zoom value. 2637 * 2638 * @type { number } 2639 * @readonly 2640 * @syscap SystemCapability.Multimedia.Camera.Core 2641 * @systemapi 2642 * @since 11 2643 */ 2644 readonly max: number; 2645 } 2646 2647 /** 2648 * Physical Aperture object 2649 * 2650 * @typedef PhysicalAperture 2651 * @syscap SystemCapability.Multimedia.Camera.Core 2652 * @systemapi 2653 * @since 11 2654 */ 2655 interface PhysicalAperture { 2656 /** 2657 * Zoom Range of the specific physical aperture. 2658 * 2659 * @type { ZoomRange } 2660 * @syscap SystemCapability.Multimedia.Camera.Core 2661 * @systemapi 2662 * @since 11 2663 */ 2664 zoomRange: ZoomRange; 2665 2666 /** 2667 * The supported physical apertures. 2668 * 2669 * @type { Array<number> } 2670 * @syscap SystemCapability.Multimedia.Camera.Core 2671 * @systemapi 2672 * @since 11 2673 */ 2674 apertures: Array<number>; 2675 } 2676 2677 /** 2678 * Aperture object. 2679 * 2680 * @interface Aperture 2681 * @syscap SystemCapability.Multimedia.Camera.Core 2682 * @systemapi 2683 * @since 11 2684 */ 2685 interface Aperture { 2686 /** 2687 * Gets the supported virtual apertures. 2688 * 2689 * @returns { Array<number> } The array of supported virtual apertures. 2690 * @throws { BusinessError } 7400103 - Session not config. 2691 * @syscap SystemCapability.Multimedia.Camera.Core 2692 * @systemapi 2693 * @since 11 2694 */ 2695 getSupportedVirtualApertures(): Array<number>; 2696 2697 /** 2698 * Gets current virtual aperture value. 2699 * 2700 * @returns { number } The current virtual aperture value. 2701 * @throws { BusinessError } 7400103 - Session not config. 2702 * @syscap SystemCapability.Multimedia.Camera.Core 2703 * @systemapi 2704 * @since 11 2705 */ 2706 getVirtualAperture(): number; 2707 2708 /** 2709 * Sets virtual aperture value. 2710 * 2711 * @param { number } aperture - virtual aperture value 2712 * @throws { BusinessError } 7400103 - Session not config. 2713 * @syscap SystemCapability.Multimedia.Camera.Core 2714 * @systemapi 2715 * @since 11 2716 */ 2717 setVirtualAperture(aperture: number): void; 2718 2719 /** 2720 * Gets the supported physical apertures. 2721 * 2722 * @returns { Array<PhysicalAperture> } The array of supported physical apertures. 2723 * @throws { BusinessError } 7400103 - Session not config. 2724 * @syscap SystemCapability.Multimedia.Camera.Core 2725 * @systemapi 2726 * @since 11 2727 */ 2728 getSupportedPhysicalApertures(): Array<PhysicalAperture>; 2729 2730 /** 2731 * Gets current physical aperture value. 2732 * 2733 * @returns { number } The current physical aperture value. 2734 * @throws { BusinessError } 7400103 - Session not config. 2735 * @syscap SystemCapability.Multimedia.Camera.Core 2736 * @systemapi 2737 * @since 11 2738 */ 2739 getPhysicalAperture(): number; 2740 2741 /** 2742 * Sets physical aperture value. 2743 * 2744 * @param { number } aperture - physical aperture value 2745 * @throws { BusinessError } 7400103 - Session not config. 2746 * @syscap SystemCapability.Multimedia.Camera.Core 2747 * @systemapi 2748 * @since 11 2749 */ 2750 setPhysicalAperture(aperture: number): void; 2751 } 2752 2753 /** 2754 * Portrait Photo session object. 2755 * 2756 * @interface PortraitPhotoSession 2757 * @syscap SystemCapability.Multimedia.Camera.Core 2758 * @systemapi 2759 * @since 11 2760 */ 2761 interface PortraitPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty, ColorEffect, ColorManagement, Portrait, Aperture { 2762 /** 2763 * Subscribes to error events. 2764 * 2765 * @param { 'error' } type - Event type. 2766 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2767 * @syscap SystemCapability.Multimedia.Camera.Core 2768 * @since 10 2769 */ 2770 on(type: 'error', callback: ErrorCallback): void; 2771 2772 /** 2773 * Unsubscribes from error events. 2774 * 2775 * @param { 'error' } type - Event type. 2776 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2777 * @syscap SystemCapability.Multimedia.Camera.Core 2778 * @since 10 2779 */ 2780 off(type: 'error', callback?: ErrorCallback): void; 2781 2782 /** 2783 * Subscribes focus status change event callback. 2784 * 2785 * @param { 'focusStateChange' } type - Event type. 2786 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2787 * @syscap SystemCapability.Multimedia.Camera.Core 2788 * @since 10 2789 */ 2790 on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void; 2791 2792 /** 2793 * Unsubscribes from focus status change event callback. 2794 * 2795 * @param { 'focusStateChange' } type - Event type. 2796 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2797 * @syscap SystemCapability.Multimedia.Camera.Core 2798 * @since 10 2799 */ 2800 off(type: 'focusStateChange', callback?: AsyncCallback<FocusState>): void; 2801 2802 /** 2803 * Subscribes zoom info event callback. 2804 * 2805 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2806 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2807 * @syscap SystemCapability.Multimedia.Camera.Core 2808 * @since 11 2809 */ 2810 on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback<SmoothZoomInfo>): void; 2811 2812 /** 2813 * Unsubscribes from zoom info event callback. 2814 * 2815 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2816 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2817 * @syscap SystemCapability.Multimedia.Camera.Core 2818 * @since 11 2819 */ 2820 off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback<SmoothZoomInfo>): void; 2821 } 2822 2823 /** 2824 * ManualExposure object. 2825 * 2826 * @interface ManualExposure 2827 * @syscap SystemCapability.Multimedia.Camera.Core 2828 * @systemapi 2829 * @since 11 2830 */ 2831 interface ManualExposure { 2832 /** 2833 * Gets the supported manual exposure range. 2834 * 2835 * @returns { Array<number> } The array of manual exposure range. 2836 * @throws { BusinessError } 7400103 - Session not config. 2837 * @syscap SystemCapability.Multimedia.Camera.Core 2838 * @systemapi 2839 * @since 11 2840 */ 2841 getSupportedExposureRange(): Array<number>; 2842 2843 /** 2844 * Gets current exposure value. 2845 * 2846 * @returns { number } The current exposure value. 2847 * @throws { BusinessError } 7400103 - Session not config. 2848 * @syscap SystemCapability.Multimedia.Camera.Core 2849 * @systemapi 2850 * @since 11 2851 */ 2852 getExposure(): number; 2853 2854 /** 2855 * Sets Exposure value. 2856 * 2857 * @param { number } exposure - Exposure value 2858 * @throws { BusinessError } 7400103 - Session not config. 2859 * @syscap SystemCapability.Multimedia.Camera.Core 2860 * @systemapi 2861 * @since 11 2862 */ 2863 setExposure(exposure: number): void; 2864 } 2865 2866 /** 2867 * Night photo session object. 2868 * 2869 * @interface NightPhotoSession 2870 * @syscap SystemCapability.Multimedia.Camera.Core 2871 * @systemapi 2872 * @since 11 2873 */ 2874 interface NightPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ColorManagement, ManualExposure { 2875 /** 2876 * Subscribes to error events. 2877 * 2878 * @param { 'error' } type - Event type. 2879 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2880 * @syscap SystemCapability.Multimedia.Camera.Core 2881 * @since 10 2882 */ 2883 on(type: 'error', callback: ErrorCallback): void; 2884 2885 /** 2886 * Unsubscribes from error events. 2887 * 2888 * @param { 'error' } type - Event type. 2889 * @param { ErrorCallback } callback - Callback used to get the capture session errors. 2890 * @syscap SystemCapability.Multimedia.Camera.Core 2891 * @since 10 2892 */ 2893 off(type: 'error', callback?: ErrorCallback): void; 2894 2895 /** 2896 * Subscribes focus status change event callback. 2897 * 2898 * @param { 'focusStateChange' } type - Event type. 2899 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2900 * @syscap SystemCapability.Multimedia.Camera.Core 2901 * @since 10 2902 */ 2903 on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void; 2904 2905 /** 2906 * Unsubscribes from focus status change event callback. 2907 * 2908 * @param { 'focusStateChange' } type - Event type. 2909 * @param { AsyncCallback<FocusState> } callback - Callback used to get the focus state change. 2910 * @syscap SystemCapability.Multimedia.Camera.Core 2911 * @since 10 2912 */ 2913 off(type: 'focusStateChange', callback?: AsyncCallback<FocusState>): void; 2914 2915 /** 2916 * Subscribes zoom info event callback. 2917 * 2918 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2919 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2920 * @syscap SystemCapability.Multimedia.Camera.Core 2921 * @since 11 2922 */ 2923 on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback<SmoothZoomInfo>): void; 2924 2925 /** 2926 * Unsubscribes from zoom info event callback. 2927 * 2928 * @param { 'smoothZoomInfoAvailable' } type - Event type. 2929 * @param { AsyncCallback<SmoothZoomInfo> } callback - Callback used to get the zoom info. 2930 * @syscap SystemCapability.Multimedia.Camera.Core 2931 * @since 11 2932 */ 2933 off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback<SmoothZoomInfo>): void; 2934 } 2935 2936 /** 2937 * Camera output object. 2938 * 2939 * @interface CameraOutput 2940 * @syscap SystemCapability.Multimedia.Camera.Core 2941 * @since 10 2942 */ 2943 interface CameraOutput { 2944 /** 2945 * Release output instance. 2946 * 2947 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2948 * @throws { BusinessError } 7400201 - Camera service fatal error. 2949 * @syscap SystemCapability.Multimedia.Camera.Core 2950 * @since 10 2951 */ 2952 release(callback: AsyncCallback<void>): void; 2953 2954 /** 2955 * Release output instance. 2956 * 2957 * @returns { Promise<void> } Promise used to return the result. 2958 * @throws { BusinessError } 7400201 - Camera service fatal error. 2959 * @syscap SystemCapability.Multimedia.Camera.Core 2960 * @since 10 2961 */ 2962 release(): Promise<void>; 2963 } 2964 2965 /** 2966 * SketchStatusData object 2967 * 2968 * @typedef SketchStatusData 2969 * @syscap SystemCapability.Multimedia.Camera.Core 2970 * @systemapi 2971 * @since 11 2972 */ 2973 interface SketchStatusData { 2974 /** 2975 * Status of the sketch stream. 2976 * 0 is stop, and 1 is start. 2977 * 2978 * @type { number } 2979 * @syscap SystemCapability.Multimedia.Camera.Core 2980 * @systemapi 2981 * @since 11 2982 */ 2983 status: number; 2984 2985 /** 2986 * The zoom ratio of the sketch stream. 2987 * 2988 * @type { number } 2989 * @syscap SystemCapability.Multimedia.Camera.Core 2990 * @systemapi 2991 * @since 11 2992 */ 2993 sketchRatio: number; 2994 } 2995 2996 /** 2997 * Preview output object. 2998 * 2999 * @interface PreviewOutput 3000 * @syscap SystemCapability.Multimedia.Camera.Core 3001 * @since 10 3002 */ 3003 interface PreviewOutput extends CameraOutput { 3004 /** 3005 * Start output instance. 3006 * 3007 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3008 * @throws { BusinessError } 7400103 - Session not config. 3009 * @syscap SystemCapability.Multimedia.Camera.Core 3010 * @deprecated since 11 3011 * @since 10 3012 */ 3013 start(callback: AsyncCallback<void>): void; 3014 3015 /** 3016 * Start output instance. 3017 * 3018 * @returns { Promise<void> } Promise used to return the result. 3019 * @throws { BusinessError } 7400103 - Session not config. 3020 * @syscap SystemCapability.Multimedia.Camera.Core 3021 * @deprecated since 11 3022 * @since 10 3023 */ 3024 start(): Promise<void>; 3025 3026 /** 3027 * Stop output instance. 3028 * 3029 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3030 * @syscap SystemCapability.Multimedia.Camera.Core 3031 * @deprecated since 11 3032 * @since 10 3033 */ 3034 stop(callback: AsyncCallback<void>): void; 3035 3036 /** 3037 * Stop output instance. 3038 * 3039 * @returns { Promise<void> } Promise used to return the result. 3040 * @syscap SystemCapability.Multimedia.Camera.Core 3041 * @deprecated since 11 3042 * @since 10 3043 */ 3044 stop(): Promise<void>; 3045 3046 /** 3047 * Subscribes frame start event callback. 3048 * 3049 * @param { 'frameStart' } type - Event type. 3050 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3051 * @syscap SystemCapability.Multimedia.Camera.Core 3052 * @since 10 3053 */ 3054 on(type: 'frameStart', callback: AsyncCallback<void>): void; 3055 3056 /** 3057 * Unsubscribes from frame start event callback. 3058 * 3059 * @param { 'frameStart' } type - Event type. 3060 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3061 * @syscap SystemCapability.Multimedia.Camera.Core 3062 * @since 10 3063 */ 3064 off(type: 'frameStart', callback?: AsyncCallback<void>): void; 3065 3066 /** 3067 * Subscribes frame end event callback. 3068 * 3069 * @param { 'frameEnd' } type - Event type. 3070 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3071 * @syscap SystemCapability.Multimedia.Camera.Core 3072 * @since 10 3073 */ 3074 on(type: 'frameEnd', callback: AsyncCallback<void>): void; 3075 3076 /** 3077 * Unsubscribes from frame end event callback. 3078 * 3079 * @param { 'frameEnd' } type - Event type. 3080 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3081 * @syscap SystemCapability.Multimedia.Camera.Core 3082 * @since 10 3083 */ 3084 off(type: 'frameEnd', callback?: AsyncCallback<void>): void; 3085 3086 /** 3087 * Subscribes to error events. 3088 * 3089 * @param { 'error' } type - Event type. 3090 * @param { ErrorCallback } callback - Callback used to get the preview output errors. 3091 * @syscap SystemCapability.Multimedia.Camera.Core 3092 * @since 10 3093 */ 3094 on(type: 'error', callback: ErrorCallback): void; 3095 3096 /** 3097 * Unsubscribes from error events. 3098 * 3099 * @param { 'error' } type - Event type. 3100 * @param { ErrorCallback } callback - Callback used to get the preview output errors. 3101 * @syscap SystemCapability.Multimedia.Camera.Core 3102 * @since 10 3103 */ 3104 off(type: 'error', callback?: ErrorCallback): void; 3105 3106 /** 3107 * Adds a deferred surface. 3108 * 3109 * @param { string } surfaceId - Surface object id used in camera photo output. 3110 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 3111 * @syscap SystemCapability.Multimedia.Camera.Core 3112 * @systemapi 3113 * @since 10 3114 */ 3115 addDeferredSurface(surfaceId: string): void; 3116 3117 /** 3118 * Determine whether camera sketch is supported. 3119 * 3120 * @returns { boolean } Is camera sketch supported. 3121 * @syscap SystemCapability.Multimedia.Camera.Core 3122 * @systemapi 3123 * @since 11 3124 */ 3125 isSketchSupported(): boolean; 3126 3127 /** 3128 * Gets the specific zoom ratio when sketch stream open. 3129 * 3130 * @returns { number } The specific zoom ratio of sketch. 3131 * @throws { BusinessError } 7400103 - Session not config. 3132 * @syscap SystemCapability.Multimedia.Camera.Core 3133 * @systemapi 3134 * @since 11 3135 */ 3136 getSketchRatio(): number; 3137 3138 /** 3139 * Enable sketch for camera. 3140 * 3141 * @param { boolean } enabled - enable sketch for camera if TRUE. 3142 * @throws { BusinessError } 7400103 - Session not config. 3143 * @syscap SystemCapability.Multimedia.Camera.Core 3144 * @systemapi 3145 * @since 11 3146 */ 3147 enalbeSketch(enabled: boolean): void; 3148 3149 /** 3150 * Attach surface to the sketch stream. 3151 * 3152 * @param { string } surfaceId - Surface object id used in sketch stream. 3153 * @throws { BusinessError } 7400103 - Session not config. 3154 * @syscap SystemCapability.Multimedia.Camera.Core 3155 * @systemapi 3156 * @since 11 3157 */ 3158 attachSketchSurface(surfaceId: string): void; 3159 3160 /** 3161 * Subscribes sketch status changed event callback. 3162 * 3163 * @param { 'sketchStatusChanged' } type - Event type. 3164 * @param { AsyncCallback<SketchStatusData> } callback - Callback used to sketch status data. 3165 * @syscap SystemCapability.Multimedia.Camera.Core 3166 * @systemapi 3167 * @since 11 3168 */ 3169 on(type: 'sketchStatusChanged', callback: AsyncCallback<SketchStatusData>): void; 3170 3171 /** 3172 * Unsubscribes sketch status changed event callback. 3173 * 3174 * @param { 'sketchStatusChanged' } type - Event type. 3175 * @param { AsyncCallback<SketchStatusData> } callback - Callback used to get sketch status data. 3176 * @syscap SystemCapability.Multimedia.Camera.Core 3177 * @systemapi 3178 * @since 11 3179 */ 3180 off(type: 'sketchStatusChanged', callback?: AsyncCallback<SketchStatusData>): void; 3181 } 3182 3183 /** 3184 * Enumerates the image rotation angles. 3185 * 3186 * @enum { number } 3187 * @syscap SystemCapability.Multimedia.Camera.Core 3188 * @since 10 3189 */ 3190 enum ImageRotation { 3191 /** 3192 * The capture image rotates 0 degrees. 3193 * 3194 * @syscap SystemCapability.Multimedia.Camera.Core 3195 * @since 10 3196 */ 3197 ROTATION_0 = 0, 3198 3199 /** 3200 * The capture image rotates 90 degrees. 3201 * 3202 * @syscap SystemCapability.Multimedia.Camera.Core 3203 * @since 10 3204 */ 3205 ROTATION_90 = 90, 3206 3207 /** 3208 * The capture image rotates 180 degrees. 3209 * 3210 * @syscap SystemCapability.Multimedia.Camera.Core 3211 * @since 10 3212 */ 3213 ROTATION_180 = 180, 3214 3215 /** 3216 * The capture image rotates 270 degrees. 3217 * 3218 * @syscap SystemCapability.Multimedia.Camera.Core 3219 * @since 10 3220 */ 3221 ROTATION_270 = 270 3222 } 3223 3224 /** 3225 * Photo capture location 3226 * 3227 * @typedef Location 3228 * @syscap SystemCapability.Multimedia.Camera.Core 3229 * @since 10 3230 */ 3231 interface Location { 3232 /** 3233 * Latitude. 3234 * 3235 * @type { number } 3236 * @syscap SystemCapability.Multimedia.Camera.Core 3237 * @since 10 3238 */ 3239 latitude: number; 3240 3241 /** 3242 * Longitude. 3243 * 3244 * @type { number } 3245 * @syscap SystemCapability.Multimedia.Camera.Core 3246 * @since 10 3247 */ 3248 longitude: number; 3249 3250 /** 3251 * Altitude. 3252 * 3253 * @type { number } 3254 * @syscap SystemCapability.Multimedia.Camera.Core 3255 * @since 10 3256 */ 3257 altitude: number; 3258 } 3259 3260 /** 3261 * Enumerates the image quality levels. 3262 * 3263 * @enum { number } 3264 * @syscap SystemCapability.Multimedia.Camera.Core 3265 * @since 10 3266 */ 3267 enum QualityLevel { 3268 /** 3269 * High image quality. 3270 * 3271 * @syscap SystemCapability.Multimedia.Camera.Core 3272 * @since 10 3273 */ 3274 QUALITY_LEVEL_HIGH = 0, 3275 3276 /** 3277 * Medium image quality. 3278 * 3279 * @syscap SystemCapability.Multimedia.Camera.Core 3280 * @since 10 3281 */ 3282 QUALITY_LEVEL_MEDIUM = 1, 3283 3284 /** 3285 * Low image quality. 3286 * 3287 * @syscap SystemCapability.Multimedia.Camera.Core 3288 * @since 10 3289 */ 3290 QUALITY_LEVEL_LOW = 2 3291 } 3292 3293 /** 3294 * Photo capture options to set. 3295 * 3296 * @typedef PhotoCaptureSetting 3297 * @syscap SystemCapability.Multimedia.Camera.Core 3298 * @since 10 3299 */ 3300 interface PhotoCaptureSetting { 3301 /** 3302 * Photo image quality. 3303 * 3304 * @type { ?QualityLevel } 3305 * @syscap SystemCapability.Multimedia.Camera.Core 3306 * @since 10 3307 */ 3308 quality?: QualityLevel; 3309 3310 /** 3311 * Photo rotation. 3312 * 3313 * @type { ?ImageRotation } 3314 * @syscap SystemCapability.Multimedia.Camera.Core 3315 * @since 10 3316 */ 3317 rotation?: ImageRotation; 3318 3319 /** 3320 * Photo location. 3321 * 3322 * @type { ?Location } 3323 * @syscap SystemCapability.Multimedia.Camera.Core 3324 * @since 10 3325 */ 3326 location?: Location; 3327 3328 /** 3329 * Set the mirror photo function switch, default to false. 3330 * 3331 * @type { ?boolean } 3332 * @syscap SystemCapability.Multimedia.Camera.Core 3333 * @since 10 3334 */ 3335 mirror?: boolean; 3336 } 3337 3338 /** 3339 * Enumerates the delivery image types. 3340 * 3341 * @enum { number } 3342 * @syscap SystemCapability.Multimedia.Camera.Core 3343 * @systemapi 3344 * @since 11 3345 */ 3346 enum DeferredDeliveryImageType { 3347 /** 3348 * Undefer image delivery. 3349 * 3350 * @syscap SystemCapability.Multimedia.Camera.Core 3351 * @systemapi 3352 * @since 11 3353 */ 3354 NONE = 0, 3355 3356 /** 3357 * Defer photo delivery when capturing photos. 3358 * 3359 * @syscap SystemCapability.Multimedia.Camera.Core 3360 * @systemapi 3361 * @since 11 3362 */ 3363 PHOTO = 1, 3364 3365 /** 3366 * Defer video delivery when capturing videos. 3367 * 3368 * @syscap SystemCapability.Multimedia.Camera.Core 3369 * @systemapi 3370 * @since 11 3371 */ 3372 VIDEO = 2 3373 } 3374 3375 /** 3376 * Photo object 3377 * 3378 * @typedef Photo 3379 * @syscap SystemCapability.Multimedia.Camera.Core 3380 * @since 11 3381 */ 3382 interface Photo { 3383 /** 3384 * Main image. 3385 * 3386 * @type { image.Image } 3387 * @syscap SystemCapability.Multimedia.Camera.Core 3388 * @since 11 3389 */ 3390 main: image.Image; 3391 3392 /** 3393 * Release Photo object. 3394 * 3395 * @returns { Promise<void> } Promise used to return the result. 3396 * @syscap SystemCapability.Multimedia.Camera.Core 3397 * @since 11 3398 */ 3399 release(): Promise<void>; 3400 } 3401 3402 /** 3403 * DeferredPhotoProxy object 3404 * 3405 * @typedef DeferredPhotoProxy 3406 * @syscap SystemCapability.Multimedia.Camera.Core 3407 * @systemapi 3408 * @since 11 3409 */ 3410 interface DeferredPhotoProxy { 3411 /** 3412 * Thumbnail image. 3413 * 3414 * @returns { Promise<image.PixelMap> } Promise used to return the result. 3415 * @syscap SystemCapability.Multimedia.Camera.Core 3416 * @systemapi 3417 * @since 11 3418 */ 3419 getThumbnail(): Promise<image.PixelMap>; 3420 3421 /** 3422 * Release DeferredPhotoProxy object. 3423 * 3424 * @returns { Promise<void> } Promise used to return the result. 3425 * @syscap SystemCapability.Multimedia.Camera.Core 3426 * @systemapi 3427 * @since 11 3428 */ 3429 release(): Promise<void>; 3430 } 3431 3432 3433 /** 3434 * Photo output object. 3435 * 3436 * @interface PhotoOutput 3437 * @syscap SystemCapability.Multimedia.Camera.Core 3438 * @since 10 3439 */ 3440 interface PhotoOutput extends CameraOutput { 3441 /** 3442 * Start capture output. 3443 * 3444 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3445 * @throws { BusinessError } 7400104 - Session not running. 3446 * @throws { BusinessError } 7400201 - Camera service fatal error. 3447 * @syscap SystemCapability.Multimedia.Camera.Core 3448 * @since 10 3449 */ 3450 capture(callback: AsyncCallback<void>): void; 3451 3452 /** 3453 * Start capture output. 3454 * 3455 * @returns { Promise<void> } Promise used to return the result. 3456 * @throws { BusinessError } 7400104 - Session not running. 3457 * @throws { BusinessError } 7400201 - Camera service fatal error. 3458 * @syscap SystemCapability.Multimedia.Camera.Core 3459 * @since 10 3460 */ 3461 capture(): Promise<void>; 3462 3463 /** 3464 * Start capture output. 3465 * 3466 * @param { PhotoCaptureSetting } setting - Photo capture settings. 3467 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3468 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 3469 * @throws { BusinessError } 7400104 - Session not running. 3470 * @throws { BusinessError } 7400201 - Camera service fatal error. 3471 * @syscap SystemCapability.Multimedia.Camera.Core 3472 * @since 10 3473 */ 3474 capture(setting: PhotoCaptureSetting, callback: AsyncCallback<void>): void; 3475 3476 /** 3477 * Start capture output. 3478 * 3479 * @param { PhotoCaptureSetting } setting - Photo capture settings. 3480 * @returns { Promise<void> } Promise used to return the result. 3481 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 3482 * @throws { BusinessError } 7400104 - Session not running. 3483 * @throws { BusinessError } 7400201 - Camera service fatal error. 3484 * @syscap SystemCapability.Multimedia.Camera.Core 3485 * @since 10 3486 */ 3487 capture(setting: PhotoCaptureSetting): Promise<void>; 3488 3489 /** 3490 * Confirm capture in Night mode. 3491 * 3492 * @throws { BusinessError } 7400104 - Session not running. 3493 * @throws { BusinessError } 7400201 - Camera service fatal error. 3494 * @syscap SystemCapability.Multimedia.Camera.Core 3495 * @systemapi 3496 * @since 11 3497 */ 3498 confirmCapture(); 3499 3500 /** 3501 * Confirm if the deferred image delivery supported in the specific device. 3502 * 3503 * @param { DeferredDeliveryImageType } type - Type of delivery image. 3504 * @returns { boolean } TRUE if the type of delivery image is support. 3505 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 3506 * @throws { BusinessError } 7400104 - Session not running. 3507 * @throws { BusinessError } 7400201 - Camera service fatal error. 3508 * @syscap SystemCapability.Multimedia.Camera.Core 3509 * @systemapi 3510 * @since 11 3511 */ 3512 isDeferredImageDeliverySupported(type: DeferredDeliveryImageType): boolean; 3513 3514 /** 3515 * Confirm if the deferred image delivery enalbed. 3516 * 3517 * @param { DeferredDeliveryImageType } type - Type of delivery image. 3518 * @returns { boolean } TRUE if the type of delivery image is enable. 3519 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 3520 * @throws { BusinessError } 7400104 - Session not running. 3521 * @throws { BusinessError } 7400201 - Camera service fatal error. 3522 * @syscap SystemCapability.Multimedia.Camera.Core 3523 * @systemapi 3524 * @since 11 3525 */ 3526 isDeferredImageDeliveryEnabled(type: DeferredDeliveryImageType): boolean; 3527 3528 /** 3529 * Sets the image type for deferred image delivery. 3530 * 3531 * @param { DeferredDeliveryImageType } type - Type of delivery image. 3532 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 3533 * @throws { BusinessError } 7400104 - Session not running. 3534 * @throws { BusinessError } 7400201 - Camera service fatal error. 3535 * @syscap SystemCapability.Multimedia.Camera.Core 3536 * @systemapi 3537 * @since 11 3538 */ 3539 deferImageDeliveryFor(type: DeferredDeliveryImageType): void; 3540 3541 /** 3542 * Subscribes photo available event callback. 3543 * 3544 * @param { 'photoAvailable' } type - Event type. 3545 * @param { AsyncCallback<Photo> } callback - Callback used to get the Photo. 3546 * @syscap SystemCapability.Multimedia.Camera.Core 3547 * @since 11 3548 */ 3549 on(type: 'photoAvailable', callback: AsyncCallback<Photo>): void; 3550 3551 /** 3552 * Unsubscribes photo available event callback. 3553 * 3554 * @param { 'photoAvailable' } type - Event type. 3555 * @param { AsyncCallback<Photo> } callback - Callback used to get the Photo. 3556 * @syscap SystemCapability.Multimedia.Camera.Core 3557 * @since 11 3558 */ 3559 off(type: 'photoAvailable', callback?: AsyncCallback<Photo>): void; 3560 3561 /** 3562 * Subscribes deferred photo proxy available event callback. 3563 * 3564 * @param { 'deferredPhotoProxyAvailable' } type - Event type. 3565 * @param { AsyncCallback<DeferredPhotoProxy> } callback - Callback used to get the DeferredPhotoProxy. 3566 * @syscap SystemCapability.Multimedia.Camera.Core 3567 * @systemapi 3568 * @since 11 3569 */ 3570 on(type: 'deferredPhotoProxyAvailable', callback: AsyncCallback<DeferredPhotoProxy>): void; 3571 3572 /** 3573 * Unsubscribes deferred photo proxy available event callback. 3574 * 3575 * @param { 'deferredPhotoProxyAvailable' } type - Event type. 3576 * @param { AsyncCallback<DeferredPhotoProxy> } callback - Callback used to get the DeferredPhotoProxy. 3577 * @syscap SystemCapability.Multimedia.Camera.Core 3578 * @systemapi 3579 * @since 11 3580 */ 3581 off(type: 'deferredPhotoProxyAvailable', callback?: AsyncCallback<DeferredPhotoProxy>): void; 3582 3583 /** 3584 * Check whether to support mirror photo. 3585 * 3586 * @returns { boolean } Is the mirror supported. 3587 * @syscap SystemCapability.Multimedia.Camera.Core 3588 * @since 10 3589 */ 3590 isMirrorSupported(): boolean; 3591 3592 /** 3593 * Subscribes capture start event callback. 3594 * 3595 * @param { 'captureStart' } type - Event type. 3596 * @param { AsyncCallback<number> } callback - Callback used to get the capture ID. 3597 * @syscap SystemCapability.Multimedia.Camera.Core 3598 * @deprecated since 11 3599 * @since 10 3600 */ 3601 on(type: 'captureStart', callback: AsyncCallback<number>): void; 3602 3603 /** 3604 * Unsubscribes from capture start event callback. 3605 * 3606 * @param { 'captureStart' } type - Event type. 3607 * @param { AsyncCallback<number> } callback - Callback used to get the capture ID. 3608 * @syscap SystemCapability.Multimedia.Camera.Core 3609 * @deprecated since 11 3610 * @since 10 3611 */ 3612 off(type: 'captureStart', callback?: AsyncCallback<number>): void; 3613 3614 /** 3615 * Subscribes capture start event callback. 3616 * 3617 * @param { 'captureStartWithInfo' } type - Event type. 3618 * @param { AsyncCallback<CaptureStartInfo> } callback - Callback used to get the capture start info. 3619 * @syscap SystemCapability.Multimedia.Camera.Core 3620 * @since 11 3621 */ 3622 on(type: 'captureStartWithInfo', callback: AsyncCallback<CaptureStartInfo>): void; 3623 3624 /** 3625 * Unsubscribes from capture start event callback. 3626 * 3627 * @param { 'captureStartWithInfo' } type - Event type. 3628 * @param { AsyncCallback<CaptureStartInfo> } callback - Callback used to get the capture start info. 3629 * @syscap SystemCapability.Multimedia.Camera.Core 3630 * @since 11 3631 */ 3632 off(type: 'captureStartWithInfo', callback?: AsyncCallback<CaptureStartInfo>): void; 3633 3634 /** 3635 * Subscribes frame shutter event callback. 3636 * 3637 * @param { 'frameShutter' } type - Event type. 3638 * @param { AsyncCallback<FrameShutterInfo> } callback - Callback used to get the frame shutter information. 3639 * @syscap SystemCapability.Multimedia.Camera.Core 3640 * @since 10 3641 */ 3642 on(type: 'frameShutter', callback: AsyncCallback<FrameShutterInfo>): void; 3643 3644 /** 3645 * Unsubscribes from frame shutter event callback. 3646 * 3647 * @param { 'frameShutter' } type - Event type. 3648 * @param { AsyncCallback<FrameShutterInfo> } callback - Callback used to get the frame shutter information. 3649 * @syscap SystemCapability.Multimedia.Camera.Core 3650 * @since 10 3651 */ 3652 off(type: 'frameShutter', callback?: AsyncCallback<FrameShutterInfo>): void; 3653 3654 /** 3655 * Subscribes capture end event callback. 3656 * 3657 * @param { 'captureEnd' } type - Event type. 3658 * @param { AsyncCallback<CaptureEndInfo> } callback - Callback used to get the capture end information. 3659 * @syscap SystemCapability.Multimedia.Camera.Core 3660 * @since 10 3661 */ 3662 on(type: 'captureEnd', callback: AsyncCallback<CaptureEndInfo>): void; 3663 3664 /** 3665 * Unsubscribes from capture end event callback. 3666 * 3667 * @param { 'captureEnd' } type - Event type. 3668 * @param { AsyncCallback<CaptureEndInfo> } callback - Callback used to get the capture end information. 3669 * @syscap SystemCapability.Multimedia.Camera.Core 3670 * @since 10 3671 */ 3672 off(type: 'captureEnd', callback?: AsyncCallback<CaptureEndInfo>): void; 3673 3674 /** 3675 * Subscribes to error events. 3676 * 3677 * @param { 'error' } type - Event type. 3678 * @param { ErrorCallback } callback - Callback used to get the photo output errors. 3679 * @syscap SystemCapability.Multimedia.Camera.Core 3680 * @since 10 3681 */ 3682 on(type: 'error', callback: ErrorCallback): void; 3683 3684 /** 3685 * Unsubscribes from error events. 3686 * 3687 * @param { 'error' } type - Event type. 3688 * @param { ErrorCallback } callback - Callback used to get the photo output errors. 3689 * @syscap SystemCapability.Multimedia.Camera.Core 3690 * @since 10 3691 */ 3692 off(type: 'error', callback?: ErrorCallback): void; 3693 3694 /** 3695 * Checks whether PhotoOutput supports quick thumbnail. 3696 * This method is valid after Session.addInput() and Session.addOutput(photoOutput) are called. 3697 * 3698 * @returns { boolean } Whether quick thumbnail is supported. 3699 * @throws { BusinessError } 7400104 - session is not running. 3700 * @syscap SystemCapability.Multimedia.Camera.Core 3701 * @systemapi 3702 * @since 10 3703 */ 3704 isQuickThumbnailSupported(): boolean; 3705 3706 /** 3707 * Enables or disables quick thumbnail. 3708 * The method must be called after Session.addInput() and Session.addOutput(photoOutput) are called. 3709 * To avoid stream reconfiguration and performance loss, 3710 * you are advised to call the method before Session.commitConfig(). 3711 * 3712 * @param { boolean } enabled - The value TRUE means to enable quick thumbnail, and FALSE means the opposite. 3713 * @throws { BusinessError } 7400104 - session is not running. 3714 * @syscap SystemCapability.Multimedia.Camera.Core 3715 * @systemapi 3716 * @since 10 3717 */ 3718 enableQuickThumbnail(enabled: boolean): void; 3719 3720 /** 3721 * Subscribes to camera thumbnail events. 3722 * This method is valid only after enableQuickThumbnail(true) is called. 3723 * 3724 * @param { 'quickThumbnail' } type - Event type. 3725 * @param { AsyncCallback<image.PixelMap> } callback - Callback used to get the quick thumbnail. 3726 * @syscap SystemCapability.Multimedia.Camera.Core 3727 * @systemapi 3728 * @since 10 3729 */ 3730 on(type: 'quickThumbnail', callback: AsyncCallback<image.PixelMap>): void; 3731 3732 /** 3733 * Unsubscribes from camera thumbnail events. 3734 * This method is valid only after enableQuickThumbnail(true) is called. 3735 * 3736 * @param { 'quickThumbnail' } type - Event type. 3737 * @param { AsyncCallback<image.PixelMap> } callback - Callback used to get the quick thumbnail. 3738 * @syscap SystemCapability.Multimedia.Camera.Core 3739 * @systemapi 3740 * @since 10 3741 */ 3742 off(type: 'quickThumbnail', callback?: AsyncCallback<image.PixelMap>): void; 3743 } 3744 3745 /** 3746 * Frame shutter callback info. 3747 * 3748 * @typedef FrameShutterInfo 3749 * @syscap SystemCapability.Multimedia.Camera.Core 3750 * @since 10 3751 */ 3752 interface FrameShutterInfo { 3753 /** 3754 * Capture id. 3755 * 3756 * @type { number } 3757 * @syscap SystemCapability.Multimedia.Camera.Core 3758 * @since 10 3759 */ 3760 captureId: number; 3761 /** 3762 * Timestamp for frame. 3763 * 3764 * @type { number } 3765 * @syscap SystemCapability.Multimedia.Camera.Core 3766 * @since 10 3767 */ 3768 timestamp: number; 3769 } 3770 3771 /** 3772 * Capture start info. 3773 * 3774 * @typedef CaptureStartInfo 3775 * @syscap SystemCapability.Multimedia.Camera.Core 3776 * @since 11 3777 */ 3778 interface CaptureStartInfo { 3779 /** 3780 * Capture id. 3781 * 3782 * @type { number } 3783 * @syscap SystemCapability.Multimedia.Camera.Core 3784 * @since 11 3785 */ 3786 captureId: number; 3787 /** 3788 * Time(in milliseconds) which after the value can obtain the photo. 3789 * 3790 * @type { number } 3791 * @syscap SystemCapability.Multimedia.Camera.Core 3792 * @since 11 3793 */ 3794 time: number; 3795 } 3796 3797 /** 3798 * Capture end info. 3799 * 3800 * @typedef CaptureEndInfo 3801 * @syscap SystemCapability.Multimedia.Camera.Core 3802 * @since 10 3803 */ 3804 interface CaptureEndInfo { 3805 /** 3806 * Capture id. 3807 * 3808 * @type { number } 3809 * @syscap SystemCapability.Multimedia.Camera.Core 3810 * @since 10 3811 */ 3812 captureId: number; 3813 /** 3814 * Frame count. 3815 * 3816 * @type { number } 3817 * @syscap SystemCapability.Multimedia.Camera.Core 3818 * @since 10 3819 */ 3820 frameCount: number; 3821 } 3822 3823 /** 3824 * Video output object. 3825 * 3826 * @interface VideoOutput 3827 * @syscap SystemCapability.Multimedia.Camera.Core 3828 * @since 10 3829 */ 3830 interface VideoOutput extends CameraOutput { 3831 /** 3832 * Start video output. 3833 * 3834 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3835 * @throws { BusinessError } 7400103 - Session not config. 3836 * @throws { BusinessError } 7400201 - Camera service fatal error. 3837 * @syscap SystemCapability.Multimedia.Camera.Core 3838 * @since 10 3839 */ 3840 start(callback: AsyncCallback<void>): void; 3841 3842 /** 3843 * Start video output. 3844 * 3845 * @returns { Promise<void> } Promise used to return the result. 3846 * @throws { BusinessError } 7400103 - Session not config. 3847 * @throws { BusinessError } 7400201 - Camera service fatal error. 3848 * @syscap SystemCapability.Multimedia.Camera.Core 3849 * @since 10 3850 */ 3851 start(): Promise<void>; 3852 3853 /** 3854 * Stop video output. 3855 * 3856 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3857 * @syscap SystemCapability.Multimedia.Camera.Core 3858 * @since 10 3859 */ 3860 stop(callback: AsyncCallback<void>): void; 3861 3862 /** 3863 * Stop video output. 3864 * 3865 * @returns { Promise<void> } Promise used to return the result. 3866 * @syscap SystemCapability.Multimedia.Camera.Core 3867 * @since 10 3868 */ 3869 stop(): Promise<void>; 3870 3871 /** 3872 * Subscribes frame start event callback. 3873 * 3874 * @param { 'frameStart' } type - Event type. 3875 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3876 * @syscap SystemCapability.Multimedia.Camera.Core 3877 * @since 10 3878 */ 3879 on(type: 'frameStart', callback: AsyncCallback<void>): void; 3880 3881 /** 3882 * Unsubscribes from frame start event callback. 3883 * 3884 * @param { 'frameStart' } type - Event type. 3885 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3886 * @syscap SystemCapability.Multimedia.Camera.Core 3887 * @since 10 3888 */ 3889 off(type: 'frameStart', callback?: AsyncCallback<void>): void; 3890 3891 /** 3892 * Subscribes frame end event callback. 3893 * 3894 * @param { 'frameEnd' } type - Event type. 3895 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3896 * @syscap SystemCapability.Multimedia.Camera.Core 3897 * @since 10 3898 */ 3899 on(type: 'frameEnd', callback: AsyncCallback<void>): void; 3900 3901 /** 3902 * Unsubscribes from frame end event callback. 3903 * 3904 * @param { 'frameEnd' } type - Event type. 3905 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3906 * @syscap SystemCapability.Multimedia.Camera.Core 3907 * @since 10 3908 */ 3909 off(type: 'frameEnd', callback?: AsyncCallback<void>): void; 3910 3911 /** 3912 * Subscribes to error events. 3913 * 3914 * @param { 'error' } type - Event type. 3915 * @param { ErrorCallback } callback - Callback used to get the video output errors. 3916 * @syscap SystemCapability.Multimedia.Camera.Core 3917 * @since 10 3918 */ 3919 on(type: 'error', callback: ErrorCallback): void; 3920 3921 /** 3922 * Unsubscribes from error events. 3923 * 3924 * @param { 'error' } type - Event type. 3925 * @param { ErrorCallback } callback - Callback used to get the video output errors. 3926 * @syscap SystemCapability.Multimedia.Camera.Core 3927 * @since 10 3928 */ 3929 off(type: 'error', callback?: ErrorCallback): void; 3930 } 3931 3932 /** 3933 * Metadata object type. 3934 * 3935 * @enum { number } 3936 * @syscap SystemCapability.Multimedia.Camera.Core 3937 * @since 10 3938 */ 3939 enum MetadataObjectType { 3940 FACE_DETECTION = 0 3941 } 3942 3943 /** 3944 * Rectangle definition. 3945 * 3946 * @typedef Rect 3947 * @syscap SystemCapability.Multimedia.Camera.Core 3948 * @since 10 3949 */ 3950 interface Rect { 3951 /** 3952 * X coordinator of top left point. 3953 * 3954 * @type { number } 3955 * @syscap SystemCapability.Multimedia.Camera.Core 3956 * @since 10 3957 */ 3958 topLeftX: number; 3959 /** 3960 * Y coordinator of top left point. 3961 * 3962 * @type { number } 3963 * @syscap SystemCapability.Multimedia.Camera.Core 3964 * @since 10 3965 */ 3966 topLeftY: number; 3967 /** 3968 * Width of this rectangle. 3969 * 3970 * @type { number } 3971 * @syscap SystemCapability.Multimedia.Camera.Core 3972 * @since 10 3973 */ 3974 width: number; 3975 /** 3976 * Height of this rectangle. 3977 * 3978 * @type { number } 3979 * @syscap SystemCapability.Multimedia.Camera.Core 3980 * @since 10 3981 */ 3982 height: number; 3983 } 3984 3985 /** 3986 * Metadata object basis. 3987 * 3988 * @typedef MetadataObject 3989 * @syscap SystemCapability.Multimedia.Camera.Core 3990 * @since 10 3991 */ 3992 interface MetadataObject { 3993 /** 3994 * Metadata object type. 3995 * 3996 * @type { MetadataObjectType } 3997 * @readonly 3998 * @syscap SystemCapability.Multimedia.Camera.Core 3999 * @since 10 4000 */ 4001 readonly type: MetadataObjectType; 4002 /** 4003 * Metadata object timestamp in milliseconds. 4004 * 4005 * @type { number } 4006 * @readonly 4007 * @syscap SystemCapability.Multimedia.Camera.Core 4008 * @since 10 4009 */ 4010 readonly timestamp: number; 4011 /** 4012 * The axis-aligned bounding box of detected metadata object. 4013 * 4014 * @type { Rect } 4015 * @readonly 4016 * @syscap SystemCapability.Multimedia.Camera.Core 4017 * @since 10 4018 */ 4019 readonly boundingBox: Rect; 4020 } 4021 4022 /** 4023 * Metadata Output object 4024 * 4025 * @interface MetadataOutput 4026 * @syscap SystemCapability.Multimedia.Camera.Core 4027 * @since 10 4028 */ 4029 interface MetadataOutput extends CameraOutput { 4030 /** 4031 * Start output metadata 4032 * 4033 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4034 * @throws { BusinessError } 7400103 - Session not config. 4035 * @throws { BusinessError } 7400201 - Camera service fatal error. 4036 * @syscap SystemCapability.Multimedia.Camera.Core 4037 * @since 10 4038 */ 4039 start(callback: AsyncCallback<void>): void; 4040 4041 /** 4042 * Start output metadata 4043 * 4044 * @returns { Promise<void> } Promise used to return the result. 4045 * @throws { BusinessError } 7400103 - Session not config. 4046 * @throws { BusinessError } 7400201 - Camera service fatal error. 4047 * @syscap SystemCapability.Multimedia.Camera.Core 4048 * @since 10 4049 */ 4050 start(): Promise<void>; 4051 4052 /** 4053 * Stop output metadata 4054 * 4055 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4056 * @syscap SystemCapability.Multimedia.Camera.Core 4057 * @since 10 4058 */ 4059 stop(callback: AsyncCallback<void>): void; 4060 4061 /** 4062 * Stop output metadata 4063 * 4064 * @returns { Promise<void> } Promise used to return the result. 4065 * @syscap SystemCapability.Multimedia.Camera.Core 4066 * @since 10 4067 */ 4068 stop(): Promise<void>; 4069 4070 /** 4071 * Subscribes to metadata objects available event callback. 4072 * 4073 * @param { 'metadataObjectsAvailable' } type - Event type. 4074 * @param { AsyncCallback<Array<MetadataObject>> } callback - Callback used to get the available metadata objects. 4075 * @syscap SystemCapability.Multimedia.Camera.Core 4076 * @since 10 4077 */ 4078 on(type: 'metadataObjectsAvailable', callback: AsyncCallback<Array<MetadataObject>>): void; 4079 4080 /** 4081 * Unsubscribes from metadata objects available event callback. 4082 * 4083 * @param { 'metadataObjectsAvailable' } type - Event type. 4084 * @param { AsyncCallback<Array<MetadataObject>> } callback - Callback used to get the available metadata objects. 4085 * @syscap SystemCapability.Multimedia.Camera.Core 4086 * @since 10 4087 */ 4088 off(type: 'metadataObjectsAvailable', callback?: AsyncCallback<Array<MetadataObject>>): void; 4089 4090 /** 4091 * Subscribes to error events. 4092 * 4093 * @param { 'error' } type - Event type. 4094 * @param { ErrorCallback } callback - Callback used to get the video output errors. 4095 * @syscap SystemCapability.Multimedia.Camera.Core 4096 * @since 10 4097 */ 4098 on(type: 'error', callback: ErrorCallback): void; 4099 4100 /** 4101 * Unsubscribes from error events. 4102 * 4103 * @param { 'error' } type - Event type. 4104 * @param { ErrorCallback } callback - Callback used to get the video output errors. 4105 * @syscap SystemCapability.Multimedia.Camera.Core 4106 * @since 10 4107 */ 4108 off(type: 'error', callback?: ErrorCallback): void; 4109 } 4110} 4111 4112export default camera; 4113