手动对焦查询对象。
isFocusDistanceSupported(): boolean
检测是否支持设置对焦距离。
元服务API: 从API version 24开始,该接口支持在元服务中使用。
系统能力: SystemCapability.Multimedia.Camera.Core
返回值:
| 类型 | 说明 |
|---|---|
| boolean | 表示是否支持对焦距离。返回true表示支持,返回false表示不支持。 |
错误码:
以下错误码的详细介绍请参见Camera错误码。
| 错误码ID | 错误信息 |
|---|---|
| 7400103 | Session not config, only throw in session usage. |
示例:
import { BusinessError } from '@kit.BasicServicesKit';
function isFocusDistanceSupported(photoSession: camera.PhotoSession): boolean {
let isSupported = false;
try {
isSupported = photoSession.isFocusDistanceSupported();
} catch (error) {
let err = error as BusinessError;
console.error(`The isFocusDistanceSupported call failed. error code: ${err.code}`);
}
return isSupported;
}