openharmony 鸿蒙 arkts-apis-camera-ManualExposure

2026-08-25 浏览 (1)

Interface (ManualExposure)

ManualExposure inherits from ManualExposureQuery.

Describes a manual exposure object.

NOTE

  • The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
  • The initial APIs of this interface are supported since API version 24.

Modules to Import

import { camera } from '@kit.CameraKit';

getExposureDuration24+

getExposureDuration(): number

Obtains the exposure duration.

Atomic service API: This API can be used in atomic services since API version 24.

System capability: SystemCapability.Multimedia.Camera.Core

Returns

TypeDescription
numberExposure duration, in microseconds.

Error Codes

For details about the error codes, see Camera Error Codes.

Error CodeError Message
7400102Operation not allowed, session or inputdevice maybe abnormal.
7400103Session not config.

Example

import { BusinessError } from '@kit.BasicServicesKit';

function getExposureDuration(photoSession: camera.PhotoSession): number {
  let exposureDuration: number = 0;
  try {
    exposureDuration = photoSession.getExposureDuration();
  } catch (error) {
    // If the operation fails, error.code is returned and processed.
    let err = error as BusinessError;
    console.error(`The getExposureDuration call failed. error code: ${err.code}`);
  }
  return exposureDuration;
}

setExposureDuration24+

setExposureDuration(exposureDuration: number): void

Sets the exposure duration.

The setting takes effect only when ExposureMode is set to EXPOSURE_MODE_MANUAL.

Atomic service API: This API can be used in atomic services since API version 24.

System capability: SystemCapability.Multimedia.Camera.Core

Parameters

ParameterTypeMandatoryDescription
exposureDurationnumberYesExposure duration, in microseconds.

Error Codes

For details about the error codes, see Camera Error Codes.

Error CodeError Message
7400103Session not config.

Example

import { BusinessError } from '@kit.BasicServicesKit';

function setExposureDuration(photoSession: camera.PhotoSession, exposureDuration: number): void {
  try {
    photoSession.setExposureDuration(exposureDuration);
  } catch (error) {
    // If the operation fails, error.code is returned and processed.
    let err = error as BusinessError;
    console.error(`The setExposureDuration call failed. error code: ${err.code}`);
  }
}

onExposureInfoChange24+

onExposureInfoChange(callback: Callback<ExposureInfo>): void

Subscribes to exposure information change events. After the exposure parameters are modified, the system returns the updated exposure information.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 24.

System capability: SystemCapability.Multimedia.Camera.Core

Parameters

ParameterTypeMandatoryDescription
callbackCallback<ExposureInfo>YesCallback used to obtain the exposure information.

Example

function onExposureInfoChange(photoSession: camera.PhotoSession): void {
  photoSession.onExposureInfoChange((exposureInfo: camera.ExposureInfo) => {
    console.info(`Exposure info changed, exposureTime: ${exposureInfo.exposureTime}`);
  });
}

offExposureInfoChange24+

offExposureInfoChange(callback?: Callback<ExposureInfo>): void

Unsubscribes from exposure information change events. If you have subscribed to exposure information change events, cancel the subscription before releasing the camera object.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 24.

System capability: SystemCapability.Multimedia.Camera.Core

Parameters

ParameterTypeMandatoryDescription
callbackCallback<ExposureInfo>NoCallback used to return the result. If this parameter is specified, the subscription to the specified event with the specified callback is canceled. (The callback object cannot be an anonymous function.) Otherwise, the subscriptions to the specified event with all the callbacks are canceled.

Example

function offExposureInfoChange(photoSession: camera.PhotoSession): void {
  photoSession.offExposureInfoChange();
}

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-oh-camera-capturesession-callbacks

openharmony 鸿蒙 arkts-apis-camera-OIS

openharmony 鸿蒙 capi-oh-camera-camera-devicequeryinfo

openharmony 鸿蒙 capi-oh-camera-camera-frameraterange

openharmony 鸿蒙 capi-oh-camera-camera-outputcapability

openharmony 鸿蒙 arkts-apis-camera-Photo

openharmony 鸿蒙 capi-oh-camera-camera-profile

openharmony 鸿蒙 capi-oh-camera-camera-manager

openharmony 鸿蒙 capi-oh-camera-previewoutput-callbacks

openharmony 鸿蒙 arkts-apis-camera-ManualExposureQuery

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/k9VdPjC5