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 { Context } from './app/context'; 18import image from './@ohos.multimedia.image'; 19 20/** 21 * @namespace camera 22 * @syscap SystemCapability.Multimedia.Camera.Core 23 * @since 10 24 */ 25declare namespace camera { 26 /** 27 * Creates a CameraManager instance. 28 * 29 * @param { Context } context Current application context. 30 * @returns { CameraManager } CameraManager instance. 31 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 32 * @throws { BusinessError } 7400201 - Camera service fatal error. 33 * @syscap SystemCapability.Multimedia.Camera.Core 34 * @since 10 35 */ 36 function getCameraManager(context: Context): CameraManager; 37 /** 38 * Creates a ModeManage instance. 39 * @param context Current application context. 40 * @param callback Callback used to return the ModeManage instance. 41 * @since 9 42 * @syscap SystemCapability.Multimedia.Camera.Core 43 */ 44 function getModeManager(context: Context, callback: AsyncCallback<ModeManager>): void; 45 /** 46 * Creates a ModeManage instance. 47 * @param context Current application context. 48 * @return Promise used to return the ModeManage instance. 49 * @since 9 50 * @syscap SystemCapability.Multimedia.Camera.Core 51 */ 52 function getModeManager(context: Context): Promise<ModeManager>; 53 /** 54 * Enum for camera status. 55 * 56 * @enum { number } 57 * @syscap SystemCapability.Multimedia.Camera.Core 58 * @since 10 59 */ 60 enum CameraStatus { 61 /** 62 * Appear status. 63 * 64 * @syscap SystemCapability.Multimedia.Camera.Core 65 * @since 10 66 */ 67 CAMERA_STATUS_APPEAR = 0, 68 /** 69 * Disappear status. 70 * 71 * @syscap SystemCapability.Multimedia.Camera.Core 72 * @since 10 73 */ 74 CAMERA_STATUS_DISAPPEAR = 1, 75 /** 76 * Available status. 77 * 78 * @syscap SystemCapability.Multimedia.Camera.Core 79 * @since 10 80 */ 81 CAMERA_STATUS_AVAILABLE = 2, 82 /** 83 * Unavailable status. 84 * 85 * @syscap SystemCapability.Multimedia.Camera.Core 86 * @since 10 87 */ 88 CAMERA_STATUS_UNAVAILABLE = 3 89 } 90 /** 91 * Enum for camera mode. 92 * 93 * @enum { number } 94 * @syscap SystemCapability.Multimedia.Camera.Core 95 * @since 10 96 */ 97 enum CameraMode { 98 /** 99 * portrait mode. 100 * 101 * @syscap SystemCapability.Multimedia.Camera.Core 102 * @since 10 103 */ 104 PORTRAIT = 1, 105 } 106 /** 107 * Enum for filter type. 108 * 109 * @enum { number } 110 * @syscap SystemCapability.Multimedia.Camera.Core 111 * @since 10 112 */ 113 enum FilterType { 114 NONE = 0, 115 CLASSIC = 1, 116 DAWN = 2, 117 PURE = 3, 118 GREY = 4, 119 NATURAL = 5, 120 MORI = 6, 121 FAIR = 7, 122 PINK = 8, 123 } 124 /** 125 * Enum for portrait effect. 126 * 127 * @enum { number } 128 * @syscap SystemCapability.Multimedia.Camera.Core 129 * @since 10 130 */ 131 enum PortraitEffect { 132 OFF_EFFECT = 0, 133 CIRCLES = 1, 134 } 135 /** 136 * Enum for beauty type. 137 * 138 * @enum { number } 139 * @syscap SystemCapability.Multimedia.Camera.Core 140 * @since 10 141 */ 142 enum BeautyType { 143 AUTO_TYPE = 0, 144 SKIN_SMOOTH = 1, 145 FACE_SLENDER = 2, 146 SKIN_TONE = 3, 147 } 148 /** 149 * Profile for camera streams. 150 * 151 * @typedef Profile 152 * @syscap SystemCapability.Multimedia.Camera.Core 153 * @since 10 154 */ 155 interface Profile { 156 /** 157 * Camera format. 158 * 159 * @type { CameraFormat } 160 * @syscap SystemCapability.Multimedia.Camera.Core 161 * @since 10 162 */ 163 readonly format: CameraFormat; 164 /** 165 * Picture size. 166 * 167 * @type { Size } 168 * @syscap SystemCapability.Multimedia.Camera.Core 169 * @since 10 170 */ 171 readonly size: Size; 172 } 173 174 /** 175 * Frame rate range. 176 * 177 * @typedef FrameRateRange 178 * @syscap SystemCapability.Multimedia.Camera.Core 179 * @since 10 180 */ 181 interface FrameRateRange { 182 /** 183 * Min frame rate. 184 * 185 * @type { number } 186 * @syscap SystemCapability.Multimedia.Camera.Core 187 * @since 10 188 */ 189 readonly min: number; 190 /** 191 * Max frame rate. 192 * 193 * @type { number } 194 * @syscap SystemCapability.Multimedia.Camera.Core 195 * @since 10 196 */ 197 readonly max: number; 198 } 199 200 /** 201 * Video profile. 202 * 203 * @typedef VideoProfile 204 * @syscap SystemCapability.Multimedia.Camera.Core 205 * @since 10 206 */ 207 interface VideoProfile extends Profile { 208 /** 209 * Frame rate in unit fps (frames per second). 210 * 211 * @type { FrameRateRange } 212 * @syscap SystemCapability.Multimedia.Camera.Core 213 * @since 10 214 */ 215 readonly frameRateRange: FrameRateRange; 216 } 217 218 /** 219 * Camera output capability. 220 * 221 * @typedef CameraOutputCapability 222 * @syscap SystemCapability.Multimedia.Camera.Core 223 * @since 10 224 */ 225 interface CameraOutputCapability { 226 /** 227 * Preview profiles. 228 * 229 * @type { Array<Profile> } 230 * @syscap SystemCapability.Multimedia.Camera.Core 231 * @since 10 232 */ 233 readonly previewProfiles: Array<Profile>; 234 /** 235 * Photo profiles. 236 * 237 * @type { Array<Profile> } 238 * @syscap SystemCapability.Multimedia.Camera.Core 239 * @since 10 240 */ 241 readonly photoProfiles: Array<Profile>; 242 /** 243 * Video profiles. 244 * 245 * @type { Array<VideoProfile> } 246 * @syscap SystemCapability.Multimedia.Camera.Core 247 * @since 10 248 */ 249 readonly videoProfiles: Array<VideoProfile>; 250 /** 251 * All the supported metadata Object Types. 252 * 253 * @type { Array<MetadataObjectType> } 254 * @syscap SystemCapability.Multimedia.Camera.Core 255 * @since 10 256 */ 257 readonly supportedMetadataObjectTypes: Array<MetadataObjectType>; 258 } 259 260 /** 261 * Enum for camera error code. 262 * 263 * @enum { number } 264 * @syscap SystemCapability.Multimedia.Camera.Core 265 * @since 10 266 */ 267 enum CameraErrorCode { 268 /** 269 * Parameter missing or parameter type incorrect 270 * 271 * @syscap SystemCapability.Multimedia.Camera.Core 272 * @since 10 273 */ 274 INVALID_ARGUMENT = 7400101, 275 /** 276 * Operation not allow. 277 * 278 * @syscap SystemCapability.Multimedia.Camera.Core 279 * @since 10 280 */ 281 OPERATION_NOT_ALLOWED = 7400102, 282 /** 283 * Session not config. 284 * 285 * @syscap SystemCapability.Multimedia.Camera.Core 286 * @since 10 287 */ 288 SESSION_NOT_CONFIG = 7400103, 289 /** 290 * Session not running. 291 * 292 * @syscap SystemCapability.Multimedia.Camera.Core 293 * @since 10 294 */ 295 SESSION_NOT_RUNNING = 7400104, 296 /** 297 * Session config locked. 298 * 299 * @syscap SystemCapability.Multimedia.Camera.Core 300 * @since 10 301 */ 302 SESSION_CONFIG_LOCKED = 7400105, 303 /** 304 * Device setting locked. 305 * 306 * @syscap SystemCapability.Multimedia.Camera.Core 307 * @since 10 308 */ 309 DEVICE_SETTING_LOCKED = 7400106, 310 /** 311 * Can not use camera cause of conflict. 312 * 313 * @syscap SystemCapability.Multimedia.Camera.Core 314 * @since 10 315 */ 316 CONFLICT_CAMERA = 7400107, 317 /** 318 * Camera disabled cause of security reason. 319 * 320 * @syscap SystemCapability.Multimedia.Camera.Core 321 * @since 10 322 */ 323 DEVICE_DISABLED = 7400108, 324 /** 325 * Can not use camera cause of preempted. 326 * 327 * @syscap SystemCapability.Multimedia.Camera.Core 328 * @since 10 329 */ 330 DEVICE_PREEMPTED = 7400109, 331 /** 332 * Camera service fatal error. 333 * 334 * @syscap SystemCapability.Multimedia.Camera.Core 335 * @since 10 336 */ 337 SERVICE_FATAL_ERROR = 7400201 338 } 339 340 /** 341 * Prelaunch config object. 342 * 343 * @typedef PrelaunchConfig 344 * @syscap SystemCapability.Multimedia.Camera.Core 345 * @systemapi 346 * @since 10 347 */ 348 interface PrelaunchConfig { 349 /** 350 * Camera instance. 351 * 352 * @type { CameraDevice } 353 * @syscap SystemCapability.Multimedia.Camera.Core 354 * @systemapi 355 * @since 10 356 */ 357 cameraDevice: CameraDevice; 358 } 359 360 /** 361 * Camera manager object. 362 * 363 * @interface CameraManager 364 * @syscap SystemCapability.Multimedia.Camera.Core 365 * @since 10 366 */ 367 interface CameraManager { 368 /** 369 * Gets supported camera descriptions. 370 * 371 * @returns { Array<CameraDevice> } An array of supported cameras. 372 * @syscap SystemCapability.Multimedia.Camera.Core 373 * @since 10 374 */ 375 getSupportedCameras(): Array<CameraDevice>; 376 377 /** 378 * Gets supported output capability for specific camera. 379 * 380 * @param { CameraDevice } camera Camera device. 381 * @returns { CameraOutputCapability } The camera output capability. 382 * @syscap SystemCapability.Multimedia.Camera.Core 383 * @since 10 384 */ 385 getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability; 386 387 /** 388 * Determine whether camera is muted. 389 * 390 * @returns { boolean } Is camera muted. 391 * @syscap SystemCapability.Multimedia.Camera.Core 392 * @since 10 393 */ 394 isCameraMuted(): boolean; 395 396 /** 397 * Determine whether camera mute is supported. 398 * 399 * @returns { boolean } Is camera mute supported. 400 * @syscap SystemCapability.Multimedia.Camera.Core 401 * @systemapi 402 * @since 10 403 */ 404 isCameraMuteSupported(): boolean; 405 406 /** 407 * Mute camera. 408 * 409 * @param { boolean } mute Mute camera if TRUE, otherwise unmute camera. 410 * @syscap SystemCapability.Multimedia.Camera.Core 411 * @systemapi 412 * @since 10 413 */ 414 muteCamera(mute: boolean): void; 415 416 /** 417 * Creates a CameraInput instance by camera. 418 * 419 * @permission ohos.permission.CAMERA 420 * @param { CameraDevice } camera Camera device used to create the instance. 421 * @returns { CameraInput } The CameraInput instance. 422 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 423 * @syscap SystemCapability.Multimedia.Camera.Core 424 * @since 10 425 */ 426 createCameraInput(camera: CameraDevice): CameraInput; 427 428 /** 429 * Creates a CameraInput instance by camera position and type. 430 * 431 * @permission ohos.permission.CAMERA 432 * @param { CameraPosition } position Target camera position. 433 * @param { CameraType } type Target camera type. 434 * @returns { CameraInput } The CameraInput instance. 435 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 436 * @syscap SystemCapability.Multimedia.Camera.Core 437 * @since 10 438 */ 439 createCameraInput(position: CameraPosition, type: CameraType): CameraInput; 440 441 /** 442 * Creates a PreviewOutput instance. 443 * 444 * @param { Profile } profile Preview output profile. 445 * @param { string } surfaceId Surface object id used in camera photo output. 446 * @returns { PreviewOutput } The PreviewOutput instance. 447 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 448 * @syscap SystemCapability.Multimedia.Camera.Core 449 * @since 10 450 */ 451 createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput; 452 453 /** 454 * Creates a PhotoOutput instance. 455 * 456 * @param { Profile } profile Photo output profile. 457 * @param { string } surfaceId Surface object id used in camera photo output. 458 * @returns { PhotoOutput } The PhotoOutput instance. 459 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 460 * @syscap SystemCapability.Multimedia.Camera.Core 461 * @since 10 462 */ 463 createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput; 464 465 /** 466 * Creates a VideoOutput instance. 467 * 468 * @param { VideoProfile } profile Video profile. 469 * @param { string } surfaceId Surface object id used in camera video output. 470 * @returns { VideoOutput } The VideoOutput instance. 471 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 472 * @syscap SystemCapability.Multimedia.Camera.Core 473 * @since 10 474 */ 475 createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput; 476 477 /** 478 * Creates a MetadataOutput instance. 479 * 480 * @param { Array<MetadataObjectType> } metadataObjectTypes Array of MetadataObjectType. 481 * @returns { MetadataOutput } The MetadataOutput instance. 482 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 483 * @syscap SystemCapability.Multimedia.Camera.Core 484 * @since 10 485 */ 486 createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): MetadataOutput; 487 488 /** 489 * Gets a CaptureSession instance. 490 * 491 * @returns { CaptureSession } The CaptureSession instance. 492 * @throws { BusinessError } 7400201 - Camera service fatal error. 493 * @syscap SystemCapability.Multimedia.Camera.Core 494 * @since 10 495 */ 496 createCaptureSession(): CaptureSession; 497 498 /** 499 * Subscribes camera status change event callback. 500 * 501 * @param { 'cameraStatus' } type Event type. 502 * @param { AsyncCallback<CameraStatusInfo> } callback Callback used to get the camera status change. 503 * @syscap SystemCapability.Multimedia.Camera.Core 504 * @since 10 505 */ 506 on(type: 'cameraStatus', callback: AsyncCallback<CameraStatusInfo>): void; 507 508 /** 509 * Subscribes camera mute change event callback. 510 * 511 * @param { 'cameraMute' } type Event type. 512 * @param { AsyncCallback<boolean> } callback Callback used to get the camera mute change. 513 * @syscap SystemCapability.Multimedia.Camera.Core 514 * @systemapi 515 * @since 10 516 */ 517 on(type: 'cameraMute', callback: AsyncCallback<boolean>): void; 518 519 /** 520 * Determine whether the camera device supports prelaunch startup. 521 * Called before the setPrelaunchConfig and prelaunch function. 522 * 523 * @param { CameraDevice } camera Camera device. 524 * @returns { boolean } Is prelaunch is supported. 525 * @syscap SystemCapability.Multimedia.Camera.Core 526 * @systemapi 527 * @since 10 528 */ 529 isPrelaunchSupported(camera: CameraDevice): boolean; 530 531 /** 532 * Configure camera preheating parameters, specify camera device. 533 * Send prelaunch configuration parameters to the camera service when exit camera or change configuration for the next time. 534 * 535 * @param { PrelaunchConfig } prelaunchConfig Prelaunch configuration info. 536 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 537 * @throws { BusinessError } 7400102 - Operation not allow. 538 * @syscap SystemCapability.Multimedia.Camera.Core 539 * @systemapi 540 * @since 10 541 */ 542 setPrelaunchConfig(prelaunchConfig: PrelaunchConfig): void; 543 544 /** 545 * Enable the camera to prelaunch and start. 546 * The user clicks on the system camera icon, pulls up the camera application, and calls it simultaneously. 547 * 548 * @throws { BusinessError } 7400102 - Operation not allow. 549 * @syscap SystemCapability.Multimedia.Camera.Core 550 * @systemapi 551 * @since 10 552 */ 553 prelaunch(): void; 554 555 /** 556 * Creates a deferred PreviewOutput instance. 557 * 558 * @param { Profile } profile Preview output profile. 559 * @returns { PreviewOutput } the PreviewOutput instance. 560 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 561 * @syscap SystemCapability.Multimedia.Camera.Core 562 * @systemapi 563 * @since 10 564 */ 565 createDeferredPreviewOutput(profile: Profile): PreviewOutput; 566 } 567 568 /** 569 * Mode manager object. 570 * 571 * @interface ModeManager 572 * @syscap SystemCapability.Multimedia.Camera.Core 573 * @since 10 574 */ 575 interface ModeManager { 576 /** 577 * Gets supported mode descriptions. 578 * 579 * @returns { Array<CameraMode> } An array of supported modes. 580 * @syscap SystemCapability.Multimedia.Camera.Core 581 * @since 10 582 */ 583 getSupportedModes(camera: CameraDevice): Array<CameraMode>; 584 585 /** 586 * Gets supported output capability in specific mode for specific camera. 587 * 588 * @param { CameraDevice } camera Camera device. 589 * @param { CameraMode } camera Camera mode. 590 * @returns { CameraOutputCapability } The camera output capability. 591 * @syscap SystemCapability.Multimedia.Camera.Core 592 * @since 10 593 */ 594 getSupportedOutputCapability(camera: CameraDevice, mode: CameraMode): CameraOutputCapability; 595 596 /** 597 * Gets a CaptureSession instance for specific mode. 598 * 599 * @param { CameraMode } camera Camera mode. 600 * @returns { CaptureSession } The CaptureSession instance. 601 * @throws { BusinessError } 7400201 - Camera service fatal error. 602 * @syscap SystemCapability.Multimedia.Camera.Core 603 * @since 10 604 */ 605 createCaptureSession(mode: CameraMode): CaptureSession; 606 } 607 608 /** 609 * Camera status info. 610 * 611 * @typedef CameraStatusInfo 612 * @syscap SystemCapability.Multimedia.Camera.Core 613 * @since 10 614 */ 615 interface CameraStatusInfo { 616 /** 617 * Camera instance. 618 * 619 * @type { CameraDevice } 620 * @syscap SystemCapability.Multimedia.Camera.Core 621 * @since 10 622 */ 623 camera: CameraDevice; 624 /** 625 * Current camera status. 626 * 627 * @type { CameraStatus } 628 * @syscap SystemCapability.Multimedia.Camera.Core 629 * @since 10 630 */ 631 status: CameraStatus; 632 } 633 634 /** 635 * Enum for camera position. 636 * 637 * @enum { number } 638 * @syscap SystemCapability.Multimedia.Camera.Core 639 * @since 10 640 */ 641 enum CameraPosition { 642 /** 643 * Unspecified position. 644 * 645 * @syscap SystemCapability.Multimedia.Camera.Core 646 * @since 10 647 */ 648 CAMERA_POSITION_UNSPECIFIED = 0, 649 /** 650 * Back position. 651 * 652 * @syscap SystemCapability.Multimedia.Camera.Core 653 * @since 10 654 */ 655 CAMERA_POSITION_BACK = 1, 656 /** 657 * Front position. 658 * 659 * @syscap SystemCapability.Multimedia.Camera.Core 660 * @since 10 661 */ 662 CAMERA_POSITION_FRONT = 2 663 } 664 665 /** 666 * Enum for camera type. 667 * 668 * @enum { number } 669 * @syscap SystemCapability.Multimedia.Camera.Core 670 * @since 10 671 */ 672 enum CameraType { 673 /** 674 * Default camera type 675 * 676 * @syscap SystemCapability.Multimedia.Camera.Core 677 * @since 10 678 */ 679 CAMERA_TYPE_DEFAULT = 0, 680 681 /** 682 * Wide camera 683 * 684 * @syscap SystemCapability.Multimedia.Camera.Core 685 * @since 10 686 */ 687 CAMERA_TYPE_WIDE_ANGLE = 1, 688 689 /** 690 * Ultra wide camera 691 * 692 * @syscap SystemCapability.Multimedia.Camera.Core 693 * @since 10 694 */ 695 CAMERA_TYPE_ULTRA_WIDE = 2, 696 697 /** 698 * Telephoto camera 699 * 700 * @syscap SystemCapability.Multimedia.Camera.Core 701 * @since 10 702 */ 703 CAMERA_TYPE_TELEPHOTO = 3, 704 705 /** 706 * True depth camera 707 * 708 * @syscap SystemCapability.Multimedia.Camera.Core 709 * @since 10 710 */ 711 CAMERA_TYPE_TRUE_DEPTH = 4 712 } 713 714 /** 715 * Enum for camera connection type. 716 * 717 * @enum { number } 718 * @syscap SystemCapability.Multimedia.Camera.Core 719 * @since 10 720 */ 721 enum ConnectionType { 722 /** 723 * Built-in camera. 724 * 725 * @syscap SystemCapability.Multimedia.Camera.Core 726 * @since 10 727 */ 728 CAMERA_CONNECTION_BUILT_IN = 0, 729 730 /** 731 * Camera connected using USB 732 * 733 * @syscap SystemCapability.Multimedia.Camera.Core 734 * @since 10 735 */ 736 CAMERA_CONNECTION_USB_PLUGIN = 1, 737 738 /** 739 * Remote camera 740 * 741 * @syscap SystemCapability.Multimedia.Camera.Core 742 * @since 10 743 */ 744 CAMERA_CONNECTION_REMOTE = 2 745 } 746 747 /** 748 * Enum for remote camera device type. 749 * 750 * @enum { number } 751 * @syscap SystemCapability.Multimedia.Camera.Core 752 * @systemapi 753 * @since 10 754 */ 755 enum HostDeviceType { 756 /** 757 * Indicates an unknown device camera. 758 * 759 * @syscap SystemCapability.Multimedia.Camera.Core 760 * @systemapi 761 * @since 10 762 */ 763 UNKNOWN_TYPE = 0, 764 /** 765 * Indicates a smartphone camera. 766 * 767 * @syscap SystemCapability.Multimedia.Camera.Core 768 * @systemapi 769 * @since 10 770 */ 771 PHONE = 0x0E, 772 /** 773 * Indicates a tablet camera. 774 * 775 * @syscap SystemCapability.Multimedia.Camera.Core 776 * @systemapi 777 * @since 10 778 */ 779 TABLET = 0x11 780 } 781 782 /** 783 * Camera device object. 784 * 785 * @typedef CameraDevice 786 * @syscap SystemCapability.Multimedia.Camera.Core 787 * @since 10 788 */ 789 interface CameraDevice { 790 /** 791 * Camera id attribute. 792 * 793 * @type { string } 794 * @syscap SystemCapability.Multimedia.Camera.Core 795 * @since 10 796 */ 797 readonly cameraId: string; 798 /** 799 * Camera position attribute. 800 * 801 * @type { CameraPosition } 802 * @syscap SystemCapability.Multimedia.Camera.Core 803 * @since 10 804 */ 805 readonly cameraPosition: CameraPosition; 806 /** 807 * Camera type attribute. 808 * 809 * @type { CameraType } 810 * @syscap SystemCapability.Multimedia.Camera.Core 811 * @since 10 812 */ 813 readonly cameraType: CameraType; 814 /** 815 * Camera connection type attribute. 816 * 817 * @type { ConnectionType } 818 * @syscap SystemCapability.Multimedia.Camera.Core 819 * @since 10 820 */ 821 readonly connectionType: ConnectionType; 822 /** 823 * Camera remote camera device name attribute. 824 * 825 * @type { string } 826 * @syscap SystemCapability.Multimedia.Camera.Core 827 * @systemapi 828 * @since 10 829 */ 830 readonly hostDeviceName: string; 831 /** 832 * Camera remote camera device type attribute. 833 * 834 * @type { HostDeviceType } 835 * @syscap SystemCapability.Multimedia.Camera.Core 836 * @systemapi 837 * @since 10 838 */ 839 readonly hostDeviceType: HostDeviceType; 840 } 841 842 /** 843 * Size parameter. 844 * 845 * @typedef Size 846 * @syscap SystemCapability.Multimedia.Camera.Core 847 * @since 10 848 */ 849 interface Size { 850 /** 851 * Height. 852 * 853 * @type { number } 854 * @syscap SystemCapability.Multimedia.Camera.Core 855 * @since 10 856 */ 857 height: number; 858 /** 859 * Width. 860 * 861 * @type { number } 862 * @syscap SystemCapability.Multimedia.Camera.Core 863 * @since 10 864 */ 865 width: number; 866 } 867 868 /** 869 * Point parameter. 870 * 871 * @typedef Point 872 * @syscap SystemCapability.Multimedia.Camera.Core 873 * @since 10 874 */ 875 interface Point { 876 /** 877 * x co-ordinate 878 * 879 * @type { number } 880 * @syscap SystemCapability.Multimedia.Camera.Core 881 * @since 10 882 */ 883 x: number; 884 /** 885 * y co-ordinate 886 * 887 * @type { number } 888 * @syscap SystemCapability.Multimedia.Camera.Core 889 * @since 10 890 */ 891 y: number; 892 } 893 894 /** 895 * Camera input object. 896 * 897 * @interface CameraInput 898 * @syscap SystemCapability.Multimedia.Camera.Core 899 * @since 10 900 */ 901 interface CameraInput { 902 /** 903 * Open camera. 904 * 905 * @param { AsyncCallback<void> } callback Callback used to return the result. 906 * @throws { BusinessError } 7400107 - Can not use camera cause of conflict. 907 * @throws { BusinessError } 7400108 - Camera disabled cause of security reason. 908 * @throws { BusinessError } 7400201 - Camera service fatal error. 909 * @syscap SystemCapability.Multimedia.Camera.Core 910 * @since 10 911 */ 912 open(callback: AsyncCallback<void>): void; 913 914 /** 915 * Open camera. 916 * 917 * @returns { Promise<void> } Promise used to return the result. 918 * @throws { BusinessError } 7400107 - Can not use camera cause of conflict. 919 * @throws { BusinessError } 7400108 - Camera disabled cause of security reason. 920 * @throws { BusinessError } 7400201 - Camera service fatal error. 921 * @syscap SystemCapability.Multimedia.Camera.Core 922 * @since 10 923 */ 924 open(): Promise<void>; 925 926 /** 927 * Close camera. 928 * 929 * @param { AsyncCallback<void> } callback Callback used to return the result. 930 * @throws { BusinessError } 7400201 - Camera service fatal error. 931 * @syscap SystemCapability.Multimedia.Camera.Core 932 * @since 10 933 */ 934 close(callback: AsyncCallback<void>): void; 935 936 /** 937 * Close camera. 938 * 939 * @returns { Promise<void> } Promise used to return the result. 940 * @throws { BusinessError } 7400201 - Camera service fatal error. 941 * @syscap SystemCapability.Multimedia.Camera.Core 942 * @since 10 943 */ 944 close(): Promise<void>; 945 946 /** 947 * Subscribes error event callback. 948 * 949 * @param { 'error' } type Event type. 950 * @param { CameraDevice } camera Camera device. 951 * @param { ErrorCallback<BusinessError> } callback Callback used to get the camera input errors. 952 * @syscap SystemCapability.Multimedia.Camera.Core 953 * @since 10 954 */ 955 on(type: 'error', camera: CameraDevice, callback: ErrorCallback<BusinessError>): void; 956 } 957 958 /** 959 * Enum for camera format type. 960 * 961 * @enum { number } 962 * @syscap SystemCapability.Multimedia.Camera.Core 963 * @since 10 964 */ 965 enum CameraFormat { 966 /** 967 * RGBA 8888 Format. 968 * 969 * @syscap SystemCapability.Multimedia.Camera.Core 970 * @since 10 971 */ 972 CAMERA_FORMAT_RGBA_8888 = 3, 973 974 /** 975 * YUV 420 Format. 976 * 977 * @syscap SystemCapability.Multimedia.Camera.Core 978 * @since 10 979 */ 980 CAMERA_FORMAT_YUV_420_SP = 1003, 981 982 /** 983 * JPEG Format. 984 * 985 * @syscap SystemCapability.Multimedia.Camera.Core 986 * @since 10 987 */ 988 CAMERA_FORMAT_JPEG = 2000 989 } 990 991 /** 992 * Enum for flash mode. 993 * 994 * @enum { number } 995 * @syscap SystemCapability.Multimedia.Camera.Core 996 * @since 10 997 */ 998 enum FlashMode { 999 /** 1000 * Close mode. 1001 * 1002 * @syscap SystemCapability.Multimedia.Camera.Core 1003 * @since 10 1004 */ 1005 FLASH_MODE_CLOSE = 0, 1006 /** 1007 * Open mode. 1008 * 1009 * @syscap SystemCapability.Multimedia.Camera.Core 1010 * @since 10 1011 */ 1012 FLASH_MODE_OPEN = 1, 1013 /** 1014 * Auto mode. 1015 * 1016 * @syscap SystemCapability.Multimedia.Camera.Core 1017 * @since 10 1018 */ 1019 FLASH_MODE_AUTO = 2, 1020 /** 1021 * Always open mode. 1022 * 1023 * @syscap SystemCapability.Multimedia.Camera.Core 1024 * @since 10 1025 */ 1026 FLASH_MODE_ALWAYS_OPEN = 3 1027 } 1028 1029 /** 1030 * Enum for exposure mode. 1031 * 1032 * @enum { number } 1033 * @syscap SystemCapability.Multimedia.Camera.Core 1034 * @since 10 1035 */ 1036 enum ExposureMode { 1037 /** 1038 * Lock exposure mode. 1039 * 1040 * @syscap SystemCapability.Multimedia.Camera.Core 1041 * @since 10 1042 */ 1043 EXPOSURE_MODE_LOCKED = 0, 1044 /** 1045 * Auto exposure mode. 1046 * 1047 * @syscap SystemCapability.Multimedia.Camera.Core 1048 * @since 10 1049 */ 1050 EXPOSURE_MODE_AUTO = 1, 1051 /** 1052 * Continuous automatic exposure. 1053 * 1054 * @syscap SystemCapability.Multimedia.Camera.Core 1055 * @since 10 1056 */ 1057 EXPOSURE_MODE_CONTINUOUS_AUTO = 2 1058 } 1059 1060 /** 1061 * Enum for focus mode. 1062 * 1063 * @enum { number } 1064 * @syscap SystemCapability.Multimedia.Camera.Core 1065 * @since 10 1066 */ 1067 enum FocusMode { 1068 /** 1069 * Manual mode. 1070 * 1071 * @syscap SystemCapability.Multimedia.Camera.Core 1072 * @since 10 1073 */ 1074 FOCUS_MODE_MANUAL = 0, 1075 /** 1076 * Continuous auto mode. 1077 * 1078 * @syscap SystemCapability.Multimedia.Camera.Core 1079 * @since 10 1080 */ 1081 FOCUS_MODE_CONTINUOUS_AUTO = 1, 1082 /** 1083 * Auto mode. 1084 * 1085 * @syscap SystemCapability.Multimedia.Camera.Core 1086 * @since 10 1087 */ 1088 FOCUS_MODE_AUTO = 2, 1089 /** 1090 * Locked mode. 1091 * 1092 * @syscap SystemCapability.Multimedia.Camera.Core 1093 * @since 10 1094 */ 1095 FOCUS_MODE_LOCKED = 3 1096 } 1097 1098 /** 1099 * Enum for focus state. 1100 * 1101 * @enum { number } 1102 * @syscap SystemCapability.Multimedia.Camera.Core 1103 * @since 10 1104 */ 1105 enum FocusState { 1106 /** 1107 * Scan state. 1108 * 1109 * @syscap SystemCapability.Multimedia.Camera.Core 1110 * @since 10 1111 */ 1112 FOCUS_STATE_SCAN = 0, 1113 /** 1114 * Focused state. 1115 * 1116 * @syscap SystemCapability.Multimedia.Camera.Core 1117 * @since 10 1118 */ 1119 FOCUS_STATE_FOCUSED = 1, 1120 /** 1121 * Unfocused state. 1122 * 1123 * @syscap SystemCapability.Multimedia.Camera.Core 1124 * @since 10 1125 */ 1126 FOCUS_STATE_UNFOCUSED = 2 1127 } 1128 1129 /** 1130 * Enum for video stabilization mode. 1131 * 1132 * @enum { number } 1133 * @syscap SystemCapability.Multimedia.Camera.Core 1134 * @since 10 1135 */ 1136 enum VideoStabilizationMode { 1137 /** 1138 * Turn off video stablization. 1139 * 1140 * @syscap SystemCapability.Multimedia.Camera.Core 1141 * @since 10 1142 */ 1143 OFF = 0, 1144 /** 1145 * LOW mode provides basic stabilization effect. 1146 * 1147 * @syscap SystemCapability.Multimedia.Camera.Core 1148 * @since 10 1149 */ 1150 LOW = 1, 1151 /** 1152 * MIDDLE mode means algorithms can achieve better effects than LOW mode. 1153 * 1154 * @syscap SystemCapability.Multimedia.Camera.Core 1155 * @since 10 1156 */ 1157 MIDDLE = 2, 1158 /** 1159 * HIGH mode means algorithms can achieve better effects than MIDDLE mode. 1160 * 1161 * @syscap SystemCapability.Multimedia.Camera.Core 1162 * @since 10 1163 */ 1164 HIGH = 3, 1165 /** 1166 * Camera HDF can select mode automatically. 1167 * 1168 * @syscap SystemCapability.Multimedia.Camera.Core 1169 * @since 10 1170 */ 1171 AUTO = 4 1172 } 1173 1174 /** 1175 * Capture session object. 1176 * 1177 * @interface CaptureSession 1178 * @syscap SystemCapability.Multimedia.Camera.Core 1179 * @since 10 1180 */ 1181 interface CaptureSession { 1182 /** 1183 * Begin capture session config. 1184 * 1185 * @throws { BusinessError } 7400105 - Session config locked. 1186 * @syscap SystemCapability.Multimedia.Camera.Core 1187 * @since 10 1188 */ 1189 beginConfig(): void; 1190 1191 /** 1192 * Commit capture session config. 1193 * 1194 * @param { AsyncCallback<void> } callback Callback used to return the result. 1195 * @throws { BusinessError } 7400102 - Operation not allow. 1196 * @throws { BusinessError } 7400201 - Camera service fatal error. 1197 * @syscap SystemCapability.Multimedia.Camera.Core 1198 * @since 10 1199 */ 1200 commitConfig(callback: AsyncCallback<void>): void; 1201 1202 /** 1203 * Commit capture session config. 1204 * 1205 * @returns { Promise<void> } Promise used to return the result. 1206 * @throws { BusinessError } 7400102 - Operation not allow. 1207 * @throws { BusinessError } 7400201 - Camera service fatal error. 1208 * @syscap SystemCapability.Multimedia.Camera.Core 1209 * @since 10 1210 */ 1211 commitConfig(): Promise<void>; 1212 1213 /** 1214 * Adds a camera input. 1215 * 1216 * @param { CameraInput } cameraInput Target camera input to add. 1217 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 1218 * @throws { BusinessError } 7400102 - Operation not allow. 1219 * @syscap SystemCapability.Multimedia.Camera.Core 1220 * @since 10 1221 */ 1222 addInput(cameraInput: CameraInput): void; 1223 1224 /** 1225 * Removes a camera input. 1226 * 1227 * @param { CameraInput } cameraInput Target camera input to remove. 1228 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 1229 * @throws { BusinessError } 7400102 - Operation not allow. 1230 * @syscap SystemCapability.Multimedia.Camera.Core 1231 * @since 10 1232 */ 1233 removeInput(cameraInput: CameraInput): void; 1234 1235 /** 1236 * Adds a camera output. 1237 * 1238 * @param { CameraOutput } cameraOutput Target camera output to add. 1239 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 1240 * @throws { BusinessError } 7400102 - Operation not allow. 1241 * @syscap SystemCapability.Multimedia.Camera.Core 1242 * @since 10 1243 */ 1244 addOutput(cameraOutput: CameraOutput): void; 1245 1246 /** 1247 * Removes a camera output. 1248 * 1249 * @param { CameraOutput } cameraOutput Target camera output to remove. 1250 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 1251 * @throws { BusinessError } 7400102 - Operation not allow. 1252 * @syscap SystemCapability.Multimedia.Camera.Core 1253 * @since 10 1254 */ 1255 removeOutput(cameraOutput: CameraOutput): void; 1256 1257 /** 1258 * Starts capture session. 1259 * 1260 * @param { AsyncCallback<void> } callback Callback used to return the result. 1261 * @throws { BusinessError } 7400103 - Session not config. 1262 * @throws { BusinessError } 7400201 - Camera service fatal error. 1263 * @syscap SystemCapability.Multimedia.Camera.Core 1264 * @since 10 1265 */ 1266 start(callback: AsyncCallback<void>): void; 1267 1268 /** 1269 * Starts capture session. 1270 * 1271 * @returns { Promise<void> } Promise used to return the result. 1272 * @throws { BusinessError } 7400103 - Session not config. 1273 * @throws { BusinessError } 7400201 - Camera service fatal error. 1274 * @syscap SystemCapability.Multimedia.Camera.Core 1275 * @since 10 1276 */ 1277 start(): Promise<void>; 1278 1279 /** 1280 * Stops capture session. 1281 * 1282 * @param { AsyncCallback<void> } callback Callback used to return the result. 1283 * @throws { BusinessError } 7400201 - Camera service fatal error. 1284 * @syscap SystemCapability.Multimedia.Camera.Core 1285 * @since 10 1286 */ 1287 stop(callback: AsyncCallback<void>): void; 1288 1289 /** 1290 * Stops capture session. 1291 * 1292 * @returns { Promise<void> } Promise used to return the result. 1293 * @throws { BusinessError } 7400201 - Camera service fatal error. 1294 * @syscap SystemCapability.Multimedia.Camera.Core 1295 * @since 10 1296 */ 1297 stop(): Promise<void>; 1298 1299 /** 1300 * Release capture session instance. 1301 * 1302 * @param { AsyncCallback<void> } callback Callback used to return the result. 1303 * @throws { BusinessError } 7400201 - Camera service fatal error. 1304 * @syscap SystemCapability.Multimedia.Camera.Core 1305 * @since 10 1306 */ 1307 release(callback: AsyncCallback<void>): void; 1308 1309 /** 1310 * Release capture session instance. 1311 * 1312 * @returns { Promise<void> } Promise used to return the result. 1313 * @throws { BusinessError } 7400201 - Camera service fatal error. 1314 * @syscap SystemCapability.Multimedia.Camera.Core 1315 * @since 10 1316 */ 1317 release(): Promise<void>; 1318 1319 /** 1320 * Check if device has flash light. 1321 * 1322 * @returns { boolean } The flash light support status. 1323 * @throws { BusinessError } 7400103 - Session not config. 1324 * @syscap SystemCapability.Multimedia.Camera.Core 1325 * @since 10 1326 */ 1327 hasFlash(): boolean; 1328 1329 /** 1330 * Checks whether a specified flash mode is supported. 1331 * 1332 * @param { FlashMode } flashMode Flash mode 1333 * @returns { boolean } Is the flash mode supported. 1334 * @throws { BusinessError } 7400103 - Session not config. 1335 * @syscap SystemCapability.Multimedia.Camera.Core 1336 * @since 10 1337 */ 1338 isFlashModeSupported(flashMode: FlashMode): boolean; 1339 1340 /** 1341 * Gets current flash mode. 1342 * 1343 * @returns { FlashMode } The current flash mode. 1344 * @throws { BusinessError } 7400103 - Session not config. 1345 * @syscap SystemCapability.Multimedia.Camera.Core 1346 * @since 10 1347 */ 1348 getFlashMode(): FlashMode; 1349 1350 /** 1351 * Sets flash mode. 1352 * 1353 * @param { FlashMode } flashMode Target flash mode. 1354 * @throws { BusinessError } 7400103 - Session not config. 1355 * @syscap SystemCapability.Multimedia.Camera.Core 1356 * @since 10 1357 */ 1358 setFlashMode(flashMode: FlashMode): void; 1359 1360 /** 1361 * Checks whether a specified exposure mode is supported. 1362 * 1363 * @param { ExposureMode } aeMode Exposure mode 1364 * @returns { boolean } Is the exposure mode supported. 1365 * @throws { BusinessError } 7400103 - Session not config. 1366 * @syscap SystemCapability.Multimedia.Camera.Core 1367 * @since 10 1368 */ 1369 isExposureModeSupported(aeMode: ExposureMode): boolean; 1370 1371 /** 1372 * Gets current exposure mode. 1373 * 1374 * @returns { ExposureMode } The current exposure mode. 1375 * @throws { BusinessError } 7400103 - Session not config. 1376 * @syscap SystemCapability.Multimedia.Camera.Core 1377 * @since 10 1378 */ 1379 getExposureMode(): ExposureMode; 1380 1381 /** 1382 * Sets Exposure mode. 1383 * 1384 * @param { ExposureMode } aeMode Exposure mode 1385 * @throws { BusinessError } 7400103 - Session not config. 1386 * @syscap SystemCapability.Multimedia.Camera.Core 1387 * @since 10 1388 */ 1389 setExposureMode(aeMode: ExposureMode): void; 1390 1391 /** 1392 * Gets current metering point. 1393 * 1394 * @returns { Point } The current metering point. 1395 * @throws { BusinessError } 7400103 - Session not config. 1396 * @syscap SystemCapability.Multimedia.Camera.Core 1397 * @since 10 1398 */ 1399 getMeteringPoint(): Point; 1400 1401 /** 1402 * Set the center point of the metering area. 1403 * 1404 * @param { Point } point metering point 1405 * @throws { BusinessError } 7400103 - Session not config. 1406 * @syscap SystemCapability.Multimedia.Camera.Core 1407 * @since 10 1408 */ 1409 setMeteringPoint(point: Point): void; 1410 1411 /** 1412 * Query the exposure compensation range. 1413 * 1414 * @returns { Array<number> } The array of compensation range. 1415 * @throws { BusinessError } 7400103 - Session not config. 1416 * @syscap SystemCapability.Multimedia.Camera.Core 1417 * @since 10 1418 */ 1419 getExposureBiasRange(): Array<number>; 1420 1421 /** 1422 * Set exposure compensation. 1423 * 1424 * @param { number } exposureBias Exposure compensation 1425 * @throws { BusinessError } 7400103 - Session not config. 1426 * @syscap SystemCapability.Multimedia.Camera.Core 1427 * @since 10 1428 */ 1429 setExposureBias(exposureBias: number): void; 1430 1431 /** 1432 * Query the exposure value. 1433 * 1434 * @returns { number } The exposure value. 1435 * @throws { BusinessError } 7400103 - Session not config. 1436 * @syscap SystemCapability.Multimedia.Camera.Core 1437 * @since 10 1438 */ 1439 getExposureValue(): number; 1440 1441 /** 1442 * Checks whether a specified focus mode is supported. 1443 * 1444 * @param { FocusMode } afMode Focus mode. 1445 * @returns { boolean } Is the focus mode supported. 1446 * @throws { BusinessError } 7400103 - Session not config. 1447 * @syscap SystemCapability.Multimedia.Camera.Core 1448 * @since 10 1449 */ 1450 isFocusModeSupported(afMode: FocusMode): boolean; 1451 1452 /** 1453 * Gets current focus mode. 1454 * 1455 * @returns { FocusMode } The current focus mode. 1456 * @throws { BusinessError } 7400103 - Session not config. 1457 * @syscap SystemCapability.Multimedia.Camera.Core 1458 * @since 10 1459 */ 1460 getFocusMode(): FocusMode; 1461 1462 /** 1463 * Sets focus mode. 1464 * 1465 * @param { FocusMode } afMode Target focus mode. 1466 * @throws { BusinessError } 7400103 - Session not config. 1467 * @syscap SystemCapability.Multimedia.Camera.Core 1468 * @since 10 1469 */ 1470 setFocusMode(afMode: FocusMode): void; 1471 1472 /** 1473 * Sets focus point. 1474 * 1475 * @param { Point } point Target focus point. 1476 * @throws { BusinessError } 7400103 - Session not config. 1477 * @syscap SystemCapability.Multimedia.Camera.Core 1478 * @since 10 1479 */ 1480 setFocusPoint(point: Point): void; 1481 1482 /** 1483 * Gets current focus point. 1484 * 1485 * @returns { Point } The current focus point. 1486 * @throws { BusinessError } 7400103 - Session not config. 1487 * @syscap SystemCapability.Multimedia.Camera.Core 1488 * @since 10 1489 */ 1490 getFocusPoint(): Point; 1491 1492 /** 1493 * Gets current focal length. 1494 * 1495 * @returns { number } The current focal point. 1496 * @throws { BusinessError } 7400103 - Session not config. 1497 * @syscap SystemCapability.Multimedia.Camera.Core 1498 * @since 10 1499 */ 1500 getFocalLength(): number; 1501 1502 /** 1503 * Gets all supported zoom ratio range. 1504 * 1505 * @returns { Array<number> } The zoom ratio range. 1506 * @throws { BusinessError } 7400103 - Session not config. 1507 * @syscap SystemCapability.Multimedia.Camera.Core 1508 * @since 10 1509 */ 1510 getZoomRatioRange(): Array<number>; 1511 1512 /** 1513 * Gets zoom ratio. 1514 * 1515 * @returns { number } The zoom ratio value. 1516 * @throws { BusinessError } 7400103 - Session not config. 1517 * @syscap SystemCapability.Multimedia.Camera.Core 1518 * @since 10 1519 */ 1520 getZoomRatio(): number; 1521 1522 /** 1523 * Sets zoom ratio. 1524 * 1525 * @param { number } zoomRatio Target zoom ratio. 1526 * @throws { BusinessError } 7400103 - Session not config. 1527 * @syscap SystemCapability.Multimedia.Camera.Core 1528 * @since 10 1529 */ 1530 setZoomRatio(zoomRatio: number): void; 1531 1532 /** 1533 * Check whether the specified video stabilization mode is supported. 1534 * 1535 * @param { VideoStabilizationMode } vsMode Video Stabilization mode. 1536 * @returns { boolean } Is flash mode supported. 1537 * @throws { BusinessError } 7400103 - Session not config. 1538 * @syscap SystemCapability.Multimedia.Camera.Core 1539 * @since 10 1540 */ 1541 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean; 1542 1543 /** 1544 * Query the video stabilization mode currently in use. 1545 * 1546 * @returns { VideoStabilizationMode } The current video stabilization mode. 1547 * @throws { BusinessError } 7400103 - Session not config. 1548 * @syscap SystemCapability.Multimedia.Camera.Core 1549 * @since 10 1550 */ 1551 getActiveVideoStabilizationMode(): VideoStabilizationMode; 1552 1553 /** 1554 * Set video stabilization mode. 1555 * 1556 * @param { VideoStabilizationMode } mode video stabilization mode to set. 1557 * @throws { BusinessError } 7400103 - Session not config. 1558 * @syscap SystemCapability.Multimedia.Camera.Core 1559 * @since 10 1560 */ 1561 setVideoStabilizationMode(mode: VideoStabilizationMode): void; 1562 1563 /** 1564 * Subscribes focus status change event callback. 1565 * 1566 * @param { 'focusStateChange' } type Event type. 1567 * @param { AsyncCallback<FocusState> } callback Callback used to get the focus state change. 1568 * @syscap SystemCapability.Multimedia.Camera.Core 1569 * @since 10 1570 */ 1571 on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void; 1572 1573 /** 1574 * Subscribes error event callback. 1575 * 1576 * @param { 'error' } type Event type. 1577 * @param { ErrorCallback<BusinessError> } callback Callback used to get the capture session errors. 1578 * @syscap SystemCapability.Multimedia.Camera.Core 1579 * @since 10 1580 */ 1581 on(type: 'error', callback: ErrorCallback<BusinessError>): void; 1582 } 1583 1584 /** 1585 * Portrait session object. 1586 * 1587 * @interface PortraitSession 1588 * @syscap SystemCapability.Multimedia.Camera.Core 1589 * @since 10 1590 */ 1591 interface PortraitSession { 1592 /** 1593 * Gets supported portrait effects. 1594 * 1595 * @returns { Array<PortraitEffect> } an array of supported portrait effects. 1596 * @syscap SystemCapability.Multimedia.Camera.Core 1597 * @since 10 1598 */ 1599 getSupportedPortraitEffects(): Array<PortraitEffect>; 1600 1601 /** 1602 * Query the portrait effect. 1603 * 1604 * @returns { PortraitEffect } The portrait effect. 1605 * @throws { BusinessError } 7400103 - Session not config. 1606 * @syscap SystemCapability.Multimedia.Camera.Core 1607 * @since 10 1608 */ 1609 getPortraitEffect(): PortraitEffect; 1610 1611 /** 1612 * Set portrait effect. 1613 * 1614 * @param { PortraitEffect } effect portrait effect 1615 * @throws { BusinessError } 7400103 - Session not config. 1616 * @syscap SystemCapability.Multimedia.Camera.Core 1617 * @since 10 1618 */ 1619 setPortraitEffect(effect: PortraitEffect): void; 1620 1621 /** 1622 * Gets supported filters. 1623 * 1624 * @returns { Array<FilterType> } an array of supported filters. 1625 * @syscap SystemCapability.Multimedia.Camera.Core 1626 * @since 10 1627 */ 1628 getSupportedFilters(): Array<FilterType>; 1629 1630 /** 1631 * Query the filter type. 1632 * 1633 * @returns { number } The filter type. 1634 * @throws { BusinessError } 7400103 - Session not config. 1635 * @syscap SystemCapability.Multimedia.Camera.Core 1636 * @since 10 1637 */ 1638 getFilter(): number; 1639 1640 /** 1641 * Set filter type. 1642 * 1643 * @param { number } filter filter 1644 * @throws { BusinessError } 7400103 - Session not config. 1645 * @syscap SystemCapability.Multimedia.Camera.Core 1646 * @since 10 1647 */ 1648 setFilter(filter: number): void; 1649 1650 /** 1651 * Gets supported beauty types. 1652 * 1653 * @returns { Array<BeautyType> } an array of supported beauty types. 1654 * @syscap SystemCapability.Multimedia.Camera.Core 1655 * @since 10 1656 */ 1657 getSupportedBeautyTypes(): Array<BeautyType>; 1658 1659 /** 1660 * Gets supported beauty range for specific beauty type. 1661 * 1662 * @param { BeautyType } type beauty type. 1663 * @returns { Array<number> } an array of supported ranges. 1664 * @syscap SystemCapability.Multimedia.Camera.Core 1665 * @since 10 1666 */ 1667 getSupportedBeautyRanges(type: BeautyType): Array<number>; 1668 1669 /** 1670 * Query the beauty level for specific beauty type. 1671 * 1672 * @param { BeautyType } type beauty type. 1673 * @returns { number } The beauty level. 1674 * @throws { BusinessError } 7400103 - Session not config. 1675 * @syscap SystemCapability.Multimedia.Camera.Core 1676 * @since 10 1677 */ 1678 getBeauty(type: BeautyType): number; 1679 1680 /** 1681 * Set beauty type and level. 1682 * 1683 * @param { BeautyType } type beauty type 1684 * @param { number } value beauty level 1685 * @throws { BusinessError } 7400103 - Session not config. 1686 * @syscap SystemCapability.Multimedia.Camera.Core 1687 * @since 10 1688 */ 1689 setBeauty(type: BeautyType, value: number): void; 1690 } 1691 /** 1692 * Camera output object. 1693 * 1694 * @interface CameraOutput 1695 * @syscap SystemCapability.Multimedia.Camera.Core 1696 * @since 10 1697 */ 1698 interface CameraOutput { 1699 /** 1700 * Release output instance. 1701 * 1702 * @param { AsyncCallback<void> } callback Callback used to return the result. 1703 * @throws { BusinessError } 7400201 - Camera service fatal error. 1704 * @syscap SystemCapability.Multimedia.Camera.Core 1705 * @since 10 1706 */ 1707 release(callback: AsyncCallback<void>): void; 1708 1709 /** 1710 * Release output instance. 1711 * 1712 * @returns { Promise<void> } Promise used to return the result. 1713 * @throws { BusinessError } 7400201 - Camera service fatal error. 1714 * @syscap SystemCapability.Multimedia.Camera.Core 1715 * @since 10 1716 */ 1717 release(): Promise<void>; 1718 } 1719 1720 /** 1721 * Preview output object. 1722 * 1723 * @interface PreviewOutput 1724 * @syscap SystemCapability.Multimedia.Camera.Core 1725 * @since 10 1726 */ 1727 interface PreviewOutput extends CameraOutput { 1728 /** 1729 * Start output instance. 1730 * 1731 * @param { AsyncCallback<void> } callback Callback used to return the result. 1732 * @throws { BusinessError } 7400103 - Session not config. 1733 * @syscap SystemCapability.Multimedia.Camera.Core 1734 * @since 10 1735 */ 1736 start(callback: AsyncCallback<void>): void; 1737 1738 /** 1739 * Start output instance. 1740 * 1741 * @returns { Promise<void> } Promise used to return the result. 1742 * @throws { BusinessError } 7400103 - Session not config. 1743 * @syscap SystemCapability.Multimedia.Camera.Core 1744 * @since 10 1745 */ 1746 start(): Promise<void>; 1747 1748 /** 1749 * Stop output instance. 1750 * 1751 * @param { AsyncCallback<void> } callback Callback used to return the result. 1752 * @syscap SystemCapability.Multimedia.Camera.Core 1753 * @since 10 1754 */ 1755 stop(callback: AsyncCallback<void>): void; 1756 1757 /** 1758 * Stop output instance. 1759 * 1760 * @returns { Promise<void> } Promise used to return the result. 1761 * @syscap SystemCapability.Multimedia.Camera.Core 1762 * @since 10 1763 */ 1764 stop(): Promise<void>; 1765 1766 /** 1767 * Subscribes frame start event callback. 1768 * 1769 * @param { 'frameStart' } type Event type. 1770 * @param { AsyncCallback<void> } callback Callback used to return the result. 1771 * @syscap SystemCapability.Multimedia.Camera.Core 1772 * @since 10 1773 */ 1774 on(type: 'frameStart', callback: AsyncCallback<void>): void; 1775 1776 /** 1777 * Subscribes frame end event callback. 1778 * 1779 * @param { 'frameEnd' } type Event type. 1780 * @param { AsyncCallback<void> } callback Callback used to return the result. 1781 * @syscap SystemCapability.Multimedia.Camera.Core 1782 * @since 10 1783 */ 1784 on(type: 'frameEnd', callback: AsyncCallback<void>): void; 1785 1786 /** 1787 * Subscribes error event callback. 1788 * 1789 * @param { 'error' } type Event type. 1790 * @param { ErrorCallback<BusinessError> } callback Callback used to get the preview output errors. 1791 * @syscap SystemCapability.Multimedia.Camera.Core 1792 * @since 10 1793 */ 1794 on(type: 'error', callback: ErrorCallback<BusinessError>): void; 1795 1796 /** 1797 * Add deferred surface. 1798 * 1799 * @param { string } surfaceId Surface object id used in camera photo output. 1800 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. 1801 * @syscap SystemCapability.Multimedia.Camera.Core 1802 * @systemapi 1803 * @since 10 1804 */ 1805 addDeferredSurface(surfaceId: string): void; 1806 } 1807 1808 /** 1809 * Enumerates the image rotation angles. 1810 * 1811 * @enum { number } 1812 * @syscap SystemCapability.Multimedia.Camera.Core 1813 * @since 10 1814 */ 1815 enum ImageRotation { 1816 /** 1817 * The capture image rotates 0 degrees. 1818 * 1819 * @syscap SystemCapability.Multimedia.Camera.Core 1820 * @since 10 1821 */ 1822 ROTATION_0 = 0, 1823 1824 /** 1825 * The capture image rotates 90 degrees. 1826 * 1827 * @syscap SystemCapability.Multimedia.Camera.Core 1828 * @since 10 1829 */ 1830 ROTATION_90 = 90, 1831 1832 /** 1833 * The capture image rotates 180 degrees. 1834 * 1835 * @syscap SystemCapability.Multimedia.Camera.Core 1836 * @since 10 1837 */ 1838 ROTATION_180 = 180, 1839 1840 /** 1841 * The capture image rotates 270 degrees. 1842 * 1843 * @syscap SystemCapability.Multimedia.Camera.Core 1844 * @since 10 1845 */ 1846 ROTATION_270 = 270 1847 } 1848 1849 /** 1850 * Photo capture location 1851 * 1852 * @typedef Location 1853 * @syscap SystemCapability.Multimedia.Camera.Core 1854 * @since 10 1855 */ 1856 interface Location { 1857 /** 1858 * Latitude. 1859 * 1860 * @type { number } 1861 * @syscap SystemCapability.Multimedia.Camera.Core 1862 * @since 10 1863 */ 1864 latitude: number; 1865 1866 /** 1867 * Longitude. 1868 * 1869 * @type { number } 1870 * @syscap SystemCapability.Multimedia.Camera.Core 1871 * @since 10 1872 */ 1873 longitude: number; 1874 1875 /** 1876 * Altitude. 1877 * 1878 * @type { number } 1879 * @syscap SystemCapability.Multimedia.Camera.Core 1880 * @since 10 1881 */ 1882 altitude: number; 1883 } 1884 1885 /** 1886 * Enumerates the image quality levels. 1887 * 1888 * @enum { number } 1889 * @syscap SystemCapability.Multimedia.Camera.Core 1890 * @since 10 1891 */ 1892 enum QualityLevel { 1893 /** 1894 * High image quality. 1895 * 1896 * @syscap SystemCapability.Multimedia.Camera.Core 1897 * @since 10 1898 */ 1899 QUALITY_LEVEL_HIGH = 0, 1900 1901 /** 1902 * Medium image quality. 1903 * 1904 * @syscap SystemCapability.Multimedia.Camera.Core 1905 * @since 10 1906 */ 1907 QUALITY_LEVEL_MEDIUM = 1, 1908 1909 /** 1910 * Low image quality. 1911 * 1912 * @syscap SystemCapability.Multimedia.Camera.Core 1913 * @since 10 1914 */ 1915 QUALITY_LEVEL_LOW = 2 1916 } 1917 1918 /** 1919 * Photo capture options to set. 1920 * 1921 * @typedef PhotoCaptureSetting 1922 * @syscap SystemCapability.Multimedia.Camera.Core 1923 * @since 10 1924 */ 1925 interface PhotoCaptureSetting { 1926 /** 1927 * Photo image quality. 1928 * 1929 * @type { ?QualityLevel } 1930 * @syscap SystemCapability.Multimedia.Camera.Core 1931 * @since 10 1932 */ 1933 quality?: QualityLevel; 1934 1935 /** 1936 * Photo rotation. 1937 * 1938 * @type { ?ImageRotation } 1939 * @syscap SystemCapability.Multimedia.Camera.Core 1940 * @since 10 1941 */ 1942 rotation?: ImageRotation; 1943 1944 /** 1945 * Photo location. 1946 * 1947 * @type { ?Location } 1948 * @syscap SystemCapability.Multimedia.Camera.Core 1949 * @since 10 1950 */ 1951 location?: Location; 1952 1953 /** 1954 * Set the mirror photo function switch, default to false. 1955 * 1956 * @type { ?boolean } 1957 * @syscap SystemCapability.Multimedia.Camera.Core 1958 * @since 10 1959 */ 1960 mirror?: boolean; 1961 } 1962 1963 /** 1964 * Photo output object. 1965 * 1966 * @interface PhotoOutput 1967 * @syscap SystemCapability.Multimedia.Camera.Core 1968 * @since 10 1969 */ 1970 interface PhotoOutput extends CameraOutput { 1971 /** 1972 * Start capture output. 1973 * 1974 * @param { AsyncCallback<void> } callback Callback used to return the result. 1975 * @throws { BusinessError } 7400104 - Session not running. 1976 * @throws { BusinessError } 7400201 - Camera service fatal error. 1977 * @syscap SystemCapability.Multimedia.Camera.Core 1978 * @since 10 1979 */ 1980 capture(callback: AsyncCallback<void>): void; 1981 1982 /** 1983 * Start capture output. 1984 * 1985 * @returns { Promise<void> } Promise used to return the result. 1986 * @throws { BusinessError } 7400104 - Session not running. 1987 * @throws { BusinessError } 7400201 - Camera service fatal error. 1988 * @syscap SystemCapability.Multimedia.Camera.Core 1989 * @since 10 1990 */ 1991 capture(): Promise<void>; 1992 1993 /** 1994 * Start capture output. 1995 * 1996 * @param { PhotoCaptureSetting } setting Photo capture settings. 1997 * @param { AsyncCallback<void> } callback Callback used to return the result. 1998 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 1999 * @throws { BusinessError } 7400104 - Session not running. 2000 * @throws { BusinessError } 7400201 - Camera service fatal error. 2001 * @syscap SystemCapability.Multimedia.Camera.Core 2002 * @since 10 2003 */ 2004 capture(setting: PhotoCaptureSetting, callback: AsyncCallback<void>): void; 2005 2006 /** 2007 * Start capture output. 2008 * 2009 * @param { PhotoCaptureSetting } setting Photo capture settings. 2010 * @returns { Promise<void> } Promise used to return the result. 2011 * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect 2012 * @throws { BusinessError } 7400104 - Session not running. 2013 * @throws { BusinessError } 7400201 - Camera service fatal error. 2014 * @syscap SystemCapability.Multimedia.Camera.Core 2015 * @since 10 2016 */ 2017 capture(setting?: PhotoCaptureSetting): Promise<void>; 2018 2019 /** 2020 * Check whether to support mirror photo. 2021 * 2022 * @returns { boolean } Is the mirror supported. 2023 * @syscap SystemCapability.Multimedia.Camera.Core 2024 * @since 10 2025 */ 2026 isMirrorSupported(): boolean; 2027 2028 /** 2029 * Subscribes capture start event callback. 2030 * 2031 * @param { 'captureStart' } type Event type. 2032 * @param { AsyncCallback<number> } callback Callback used to get the capture ID. 2033 * @syscap SystemCapability.Multimedia.Camera.Core 2034 * @since 10 2035 */ 2036 on(type: 'captureStart', callback: AsyncCallback<number>): void; 2037 2038 /** 2039 * Subscribes frame shutter event callback. 2040 * 2041 * @param { 'frameShutter' } type Event type. 2042 * @param { AsyncCallback<FrameShutterInfo> } callback Callback used to get the frame shutter information. 2043 * @syscap SystemCapability.Multimedia.Camera.Core 2044 * @since 10 2045 */ 2046 on(type: 'frameShutter', callback: AsyncCallback<FrameShutterInfo>): void; 2047 2048 /** 2049 * Subscribes capture end event callback. 2050 * 2051 * @param { 'captureEnd' } type Event type. 2052 * @param { AsyncCallback<CaptureEndInfo> } callback Callback used to get the capture end information. 2053 * @syscap SystemCapability.Multimedia.Camera.Core 2054 * @since 10 2055 */ 2056 on(type: 'captureEnd', callback: AsyncCallback<CaptureEndInfo>): void; 2057 2058 /** 2059 * Subscribes error event callback. 2060 * 2061 * @param { 'error' } type Event type. 2062 * @param { ErrorCallback<BusinessError> } callback Callback used to get the photo output errors. 2063 * @syscap SystemCapability.Multimedia.Camera.Core 2064 * @since 10 2065 */ 2066 on(type: 'error', callback: ErrorCallback<BusinessError>): void; 2067 2068 /** 2069 * Check if PhotoOutput supports quick thumbnails. 2070 * Effective between CaptureSession.addIutput() and CaptureSession.addOutput(photoOutput). 2071 * 2072 * @returns { boolean } Is quick thumbnail supported. 2073 * @throws { BusinessError } 7400104 - session is not running. 2074 * @syscap SystemCapability.Multimedia.Camera.Core 2075 * @systemapi 2076 * @since 10 2077 */ 2078 isQuickThumbnailSupported(): boolean; 2079 2080 /** 2081 * Enable/disable quick thumbnails. 2082 * The method should be called after CaptureSession.addIutput() and CaptureSession.addOutput(photoOutput), 2083 * and advised to use before CaptureSession.commitConfig(). Your Application can also call this method 2084 * after CaptureSession.commitConfig(), but will cause streams reconfig, and then cause loss of performance. 2085 * 2086 * @param { boolean } enabled Enable quick thumbnail if TRUE, otherwise disable quick thumbnail. 2087 * @throws { BusinessError } 7400104 - session is not running. 2088 * @syscap SystemCapability.Multimedia.Camera.Core 2089 * @systemapi 2090 * @since 10 2091 */ 2092 enableQuickThumbnail(enabled: boolean): void; 2093 2094 /** 2095 * Configure camera thumbnail callback interface. 2096 * Effective after enableQuickThumbnail(true). 2097 * 2098 * @param { 'quickThumbnail' } type Event type. 2099 * @param { AsyncCallback<PixelMap> } callback Callback used to get the quick thumbnail. 2100 * @throws { BusinessError } 7400104 - session is not running. 2101 * @syscap SystemCapability.Multimedia.Camera.Core 2102 * @systemapi 2103 * @since 10 2104 */ 2105 on(type: 'quickThumbnail', callback: AsyncCallback<image.PixelMap>): void; 2106 } 2107 2108 /** 2109 * Frame shutter callback info. 2110 * 2111 * @typedef FrameShutterInfo 2112 * @syscap SystemCapability.Multimedia.Camera.Core 2113 * @since 10 2114 */ 2115 interface FrameShutterInfo { 2116 /** 2117 * Capture id. 2118 * 2119 * @type { number } 2120 * @syscap SystemCapability.Multimedia.Camera.Core 2121 * @since 10 2122 */ 2123 captureId: number; 2124 /** 2125 * Timestamp for frame. 2126 * 2127 * @type { number } 2128 * @syscap SystemCapability.Multimedia.Camera.Core 2129 * @since 10 2130 */ 2131 timestamp: number; 2132 } 2133 2134 /** 2135 * Capture end info. 2136 * 2137 * @typedef CaptureEndInfo 2138 * @syscap SystemCapability.Multimedia.Camera.Core 2139 * @since 10 2140 */ 2141 interface CaptureEndInfo { 2142 /** 2143 * Capture id. 2144 * 2145 * @type { number } 2146 * @syscap SystemCapability.Multimedia.Camera.Core 2147 * @since 10 2148 */ 2149 captureId: number; 2150 /** 2151 * Frame count. 2152 * 2153 * @type { number } 2154 * @syscap SystemCapability.Multimedia.Camera.Core 2155 * @since 10 2156 */ 2157 frameCount: number; 2158 } 2159 2160 /** 2161 * Video output object. 2162 * 2163 * @interface VideoOutput 2164 * @syscap SystemCapability.Multimedia.Camera.Core 2165 * @since 10 2166 */ 2167 interface VideoOutput extends CameraOutput { 2168 /** 2169 * Start video output. 2170 * 2171 * @param { AsyncCallback<void> } callback Callback used to return the result. 2172 * @throws { BusinessError } 7400103 - Session not config. 2173 * @throws { BusinessError } 7400201 - Camera service fatal error. 2174 * @syscap SystemCapability.Multimedia.Camera.Core 2175 * @since 10 2176 */ 2177 start(callback: AsyncCallback<void>): void; 2178 2179 /** 2180 * Start video output. 2181 * 2182 * @returns { Promise<void> } Promise used to return the result. 2183 * @throws { BusinessError } 7400103 - Session not config. 2184 * @throws { BusinessError } 7400201 - Camera service fatal error. 2185 * @syscap SystemCapability.Multimedia.Camera.Core 2186 * @since 10 2187 */ 2188 start(): Promise<void>; 2189 2190 /** 2191 * Stop video output. 2192 * 2193 * @param { AsyncCallback<void> } callback Callback used to return the result. 2194 * @syscap SystemCapability.Multimedia.Camera.Core 2195 * @since 10 2196 */ 2197 stop(callback: AsyncCallback<void>): void; 2198 2199 /** 2200 * Stop video output. 2201 * 2202 * @returns { Promise<void> } Promise used to return the result. 2203 * @syscap SystemCapability.Multimedia.Camera.Core 2204 * @since 10 2205 */ 2206 stop(): Promise<void>; 2207 2208 /** 2209 * Subscribes frame start event callback. 2210 * 2211 * @param { 'frameStart' } type Event type. 2212 * @param { AsyncCallback<void> } callback Callback used to return the result. 2213 * @syscap SystemCapability.Multimedia.Camera.Core 2214 * @since 10 2215 */ 2216 on(type: 'frameStart', callback: AsyncCallback<void>): void; 2217 2218 /** 2219 * Subscribes frame end event callback. 2220 * 2221 * @param { 'frameEnd' } type Event type. 2222 * @param { AsyncCallback<void> } callback Callback used to return the result. 2223 * @syscap SystemCapability.Multimedia.Camera.Core 2224 * @since 10 2225 */ 2226 on(type: 'frameEnd', callback: AsyncCallback<void>): void; 2227 2228 /** 2229 * Subscribes error event callback. 2230 * 2231 * @param { 'error' } type Event type. 2232 * @param { ErrorCallback<BusinessError> } callback Callback used to get the video output errors. 2233 * @syscap SystemCapability.Multimedia.Camera.Core 2234 * @since 10 2235 */ 2236 on(type: 'error', callback: ErrorCallback<BusinessError>): void; 2237 } 2238 2239 /** 2240 * Metadata object type. 2241 * 2242 * @enum { number } 2243 * @syscap SystemCapability.Multimedia.Camera.Core 2244 * @since 10 2245 */ 2246 enum MetadataObjectType { 2247 FACE_DETECTION = 0 2248 } 2249 2250 /** 2251 * Rectangle definition. 2252 * 2253 * @typedef Rect 2254 * @syscap SystemCapability.Multimedia.Camera.Core 2255 * @since 10 2256 */ 2257 interface Rect { 2258 /** 2259 * X coordinator of top left point. 2260 * 2261 * @type { number } 2262 * @syscap SystemCapability.Multimedia.Camera.Core 2263 * @since 10 2264 */ 2265 topLeftX: number; 2266 /** 2267 * Y coordinator of top left point. 2268 * 2269 * @type { number } 2270 * @syscap SystemCapability.Multimedia.Camera.Core 2271 * @since 10 2272 */ 2273 topLeftY: number; 2274 /** 2275 * Width of this rectangle. 2276 * 2277 * @type { number } 2278 * @syscap SystemCapability.Multimedia.Camera.Core 2279 * @since 10 2280 */ 2281 width: number; 2282 /** 2283 * Height of this rectangle. 2284 * 2285 * @type { number } 2286 * @syscap SystemCapability.Multimedia.Camera.Core 2287 * @since 10 2288 */ 2289 height: number; 2290 } 2291 2292 /** 2293 * Metadata object basis. 2294 * 2295 * @typedef MetadataObject 2296 * @syscap SystemCapability.Multimedia.Camera.Core 2297 * @since 10 2298 */ 2299 interface MetadataObject { 2300 /** 2301 * Metadata object type. 2302 * 2303 * @type { MetadataObjectType } 2304 * @syscap SystemCapability.Multimedia.Camera.Core 2305 * @since 10 2306 */ 2307 readonly type: MetadataObjectType; 2308 /** 2309 * Metadata object timestamp in milliseconds. 2310 * 2311 * @type { number } 2312 * @syscap SystemCapability.Multimedia.Camera.Core 2313 * @since 10 2314 */ 2315 readonly timestamp: number; 2316 /** 2317 * The axis-aligned bounding box of detected metadata object. 2318 * 2319 * @type { Rect } 2320 * @syscap SystemCapability.Multimedia.Camera.Core 2321 * @since 10 2322 */ 2323 readonly boundingBox: Rect; 2324 } 2325 2326 /** 2327 * Metadata Output object 2328 * 2329 * @interface MetadataOutput 2330 * @syscap SystemCapability.Multimedia.Camera.Core 2331 * @since 10 2332 */ 2333 interface MetadataOutput extends CameraOutput { 2334 /** 2335 * Start output metadata 2336 * 2337 * @param { AsyncCallback<void> } callback Callback used to return the result. 2338 * @throws { BusinessError } 7400103 - Session not config. 2339 * @throws { BusinessError } 7400201 - Camera service fatal error. 2340 * @syscap SystemCapability.Multimedia.Camera.Core 2341 * @since 10 2342 */ 2343 start(callback: AsyncCallback<void>): void; 2344 2345 /** 2346 * Start output metadata 2347 * 2348 * @returns { Promise<void> } Promise used to return the result. 2349 * @throws { BusinessError } 7400103 - Session not config. 2350 * @throws { BusinessError } 7400201 - Camera service fatal error. 2351 * @syscap SystemCapability.Multimedia.Camera.Core 2352 * @since 10 2353 */ 2354 start(): Promise<void>; 2355 2356 /** 2357 * Stop output metadata 2358 * 2359 * @param { AsyncCallback<void> } callback Callback used to return the result. 2360 * @syscap SystemCapability.Multimedia.Camera.Core 2361 * @since 10 2362 */ 2363 stop(callback: AsyncCallback<void>): void; 2364 2365 /** 2366 * Stop output metadata 2367 * 2368 * @returns { Promise<void> } Promise used to return the result. 2369 * @syscap SystemCapability.Multimedia.Camera.Core 2370 * @since 10 2371 */ 2372 stop(): Promise<void>; 2373 2374 /** 2375 * Subscribes to metadata objects available event callback. 2376 * 2377 * @param { 'metadataObjectsAvailable' } type Event type. 2378 * @param { AsyncCallback<Array<MetadataObject>> } callback Callback used to get the available metadata objects. 2379 * @syscap SystemCapability.Multimedia.Camera.Core 2380 * @since 10 2381 */ 2382 on(type: 'metadataObjectsAvailable', callback: AsyncCallback<Array<MetadataObject>>): void; 2383 2384 /** 2385 * Subscribes error event callback. 2386 * 2387 * @param { 'error' } type Event type. 2388 * @param { ErrorCallback<BusinessError> } callback Callback used to get the video output errors. 2389 * @syscap SystemCapability.Multimedia.Camera.Core 2390 * @since 10 2391 */ 2392 on(type: 'error', callback: ErrorCallback<BusinessError>): void; 2393 } 2394} 2395 2396export default camera; 2397