source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function beginConfig(session: camera.Session): void { try { session.beginConfig(); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as BusinessError; console.error(`The beginConfig call failed. ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function commitConfig(session: camera.Session): void { session.commitConfig((err: BusinessError) => { if (err) { console.error(`The commitConfig call failed. error code: ${err.code}`); return; } console.info('Callback invoked to indicate ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function commitConfig(session: camera.Session): void { session.commitConfig().then(() => { console.info('Promise returned to indicate the commit config success.'); }).catch((error: BusinessError) => { // If the operation fails, error.code is returned a...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function canAddInput(session: camera.Session, cameraInput: camera.CameraInput): void { let canAdd: boolean = session.canAddInput(cameraInput); console.info(`The input canAddInput: ${canAdd}`); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function addInput(session: camera.Session, cameraInput: camera.CameraInput): void { try { session.addInput(cameraInput); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as BusinessError; consol...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function removeInput(session: camera.Session, cameraInput: camera.CameraInput): void { try { session.removeInput(cameraInput); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as BusinessError; ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function canAddOutput(session: camera.Session, cameraOutput: camera.CameraOutput): void { let canAdd: boolean = session.canAddOutput(cameraOutput); console.info(`This addOutput can add: ${canAdd}`); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function addOutput(session: camera.Session, cameraOutput: camera.CameraOutput): void { try { session.addOutput(cameraOutput); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as BusinessError; c...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function removeOutput(session: camera.Session, previewOutput: camera.PreviewOutput): void { try { session.removeOutput(previewOutput); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as BusinessErr...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function startCaptureSession(session: camera.Session): void { session.start((err: BusinessError) => { if (err) { console.error(`Failed to start the session, error code: ${err.code}.`); return; } console.info('Callback invoked to indicate ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function startCaptureSession(session: camera.Session): void { session.start().then(() => { console.info('Promise returned to indicate the session start success.'); }).catch((error: BusinessError) => { console.error(`Failed to start the session, error c...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function stopCaptureSession(session: camera.Session): void { session.stop((err: BusinessError) => { if (err) { console.error(`Failed to stop the session, error code: ${err.code}.`); return; } console.info('Callback invoked to indicate the...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function stopCaptureSession(session: camera.Session): void { session.stop().then(() => { console.info('Promise returned to indicate the session stop success.'); }).catch((error: BusinessError) => { console.error(`Failed to stop the session, error code:...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function releaseCaptureSession(session: camera.Session): void { session.release((err: BusinessError) => { if (err) { console.error(`Failed to release the session instance, error code: ${err.code}.`); return; } console.info('Callback invok...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function releaseCaptureSession(session: camera.Session): void { session.release().then(() => { console.info('Promise returned to indicate that the session instance is released successfully.'); }).catch((error: BusinessError) => { console.error(`Failed ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setFlashMode(photoSession: camera.PhotoSession): void { try { photoSession.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as BusinessError;...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getFlashMode(photoSession: camera.PhotoSession): camera.FlashMode | undefined { let flashMode: camera.FlashMode | undefined = undefined; try { flashMode = photoSession.getFlashMode(); } catch (error) { // If the operation fails, error.code i...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function hasFlash(photoSession: camera.PhotoSession): boolean { let status: boolean = false; try { status = photoSession.hasFlash(); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as BusinessErr...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function isFlashModeSupported(photoSession: camera.PhotoSession): boolean { let status: boolean = false; try { status = photoSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO); } catch (error) { // If the operation fails, error.code is re...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getExposureMode(photoSession: camera.PhotoSession): camera.ExposureMode | undefined { let exposureMode: camera.ExposureMode | undefined = undefined; try { exposureMode = photoSession.getExposureMode(); } catch (error) { // If the operation f...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setExposureMode(photoSession: camera.PhotoSession): void { try { photoSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getMeteringPoint(photoSession: camera.PhotoSession): camera.Point | undefined { let exposurePoint: camera.Point | undefined = undefined; try { exposurePoint = photoSession.getMeteringPoint(); } catch (error) { // If the operation fails, erro...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setMeteringPoint(photoSession: camera.PhotoSession): void { const point: camera.Point = {x: 1, y: 1}; try { photoSession.setMeteringPoint(point); } catch (error) { // If the operation fails, error.code is returned and processed. let err ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getExposureBiasRange(photoSession: camera.PhotoSession): Array<number> { let biasRangeArray: Array<number> = []; try { biasRangeArray = photoSession.getExposureBiasRange(); } catch (error) { // If the operation fails, error.code is returned ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setExposureBias(photoSession: camera.PhotoSession, biasRangeArray: Array<number>): void { if (biasRangeArray && biasRangeArray.length > 0) { let exposureBias = biasRangeArray[0]; try { photoSession.setExposureBias(exposureBias); } catc...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getExposureValue(photoSession: camera.PhotoSession): number { const invalidValue: number = -1; let exposureValue: number = invalidValue; try { exposureValue = photoSession.getExposureValue(); } catch (error) { // If the operation fails, er...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function isExposureModeSupported(photoSession: camera.PhotoSession): boolean { let isSupported: boolean = false; try { isSupported = photoSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED); } catch (error) { // If the operation...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getExposureBiasRange(photoSession: camera.PhotoSession): Array<number> { let biasRangeArray: Array<number> = []; try { biasRangeArray = photoSession.getExposureBiasRange(); } catch (error) { // If the operation fails, error.code is returned ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setFocusMode(photoSession: camera.PhotoSession): void { try { photoSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as BusinessError;...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getFocusMode(photoSession: camera.PhotoSession): camera.FocusMode | undefined { let afMode: camera.FocusMode | undefined = undefined; try { afMode = photoSession.getFocusMode(); } catch (error) { // If the operation fails, error.code is retu...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setFocusPoint(photoSession: camera.PhotoSession): void { const focusPoint: camera.Point = {x: 1, y: 1}; try { photoSession.setFocusPoint(focusPoint); } catch (error) { // If the operation fails, error.code is returned and processed. let ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getFocusPoint(photoSession: camera.PhotoSession): camera.Point | undefined { let point: camera.Point | undefined = undefined; try { point = photoSession.getFocusPoint(); } catch (error) { // If the operation fails, error.code is returned and...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getFocalLength(photoSession: camera.PhotoSession): number { const invalidValue: number = -1; let focalLength: number = invalidValue; try { focalLength = photoSession.getFocalLength(); } catch (error) { // If the operation fails, error.code...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function isFocusModeSupported(photoSession: camera.PhotoSession): boolean { let status: boolean = false; try { status = photoSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO); } catch (error) { // If the operation fails, error.code is re...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setZoomRatio(photoSession: camera.PhotoSession, zoomRatioRange: Array<number>): void { if (zoomRatioRange === undefined || zoomRatioRange.length <= 0) { return; } let zoomRatio = zoomRatioRange[0]; try { photoSession.setZoomRatio(zoomRatio...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getZoomRatio(photoSession: camera.PhotoSession): number { const invalidValue: number = -1; let zoomRatio: number = invalidValue; try { zoomRatio = photoSession.getZoomRatio(); } catch (error) { // If the operation fails, error.code is retu...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setSmoothZoom(sessionExtendsZoom: camera.Zoom, targetZoomRatio: number, mode: camera.SmoothZoomMode): void { sessionExtendsZoom.setSmoothZoom(targetZoomRatio, mode); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getZoomRatioRange(photoSession: camera.PhotoSession): Array<number> { let zoomRatioRange: Array<number> = []; try { zoomRatioRange = photoSession.getZoomRatioRange(); } catch (error) { // If the operation fails, error.code is returned and pr...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getActiveVideoStabilizationMode(videoSession: camera.VideoSession): camera.VideoStabilizationMode | undefined { let vsMode: camera.VideoStabilizationMode | undefined = undefined; try { vsMode = videoSession.getActiveVideoStabilizationMode(); } c...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setVideoStabilizationMode(videoSession: camera.VideoSession): void { try { videoSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF); } catch (error) { // If the operation fails, error.code is returned and processed. let er...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function isVideoStabilizationModeSupported(videoSession: camera.VideoSession): boolean { let isSupported: boolean = false; try { isSupported = videoSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF); } catch (error) { // If ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function beginConfig(captureSession: camera.CaptureSession): void { try { captureSession.beginConfig(); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as BusinessError; console.error(`The begi...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function commitConfig(captureSession: camera.CaptureSession): void { captureSession.commitConfig((err: BusinessError) => { if (err) { console.error(`The commitConfig call failed. error code: ${err.code}`); return; } console.info('Callback...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function commitConfig(captureSession: camera.CaptureSession): void { captureSession.commitConfig().then(() => { console.info('Promise returned to indicate the commit config success.'); }).catch((error: BusinessError) => { // If the operation fails, err...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function addInput(captureSession: camera.CaptureSession, cameraInput: camera.CameraInput): void { try { captureSession.addInput(cameraInput); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as Busi...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function removeInput(captureSession: camera.CaptureSession, cameraInput: camera.CameraInput): void { try { captureSession.removeInput(cameraInput); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error a...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function addOutput(captureSession: camera.CaptureSession, cameraOutput: camera.CameraOutput): void { try { captureSession.addOutput(cameraOutput); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function removeOutput(captureSession: camera.CaptureSession, previewOutput: camera.PreviewOutput): void { try { captureSession.removeOutput(previewOutput); } catch (error) { // If the operation fails, error.code is returned and processed. let err =...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function startCaptureSession(captureSession: camera.CaptureSession): void { captureSession.start((err: BusinessError) => { if (err) { console.error(`Failed to start the session, error code: ${err.code}.`); return; } console.info('Callback...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function startCaptureSession(captureSession: camera.CaptureSession): void { captureSession.start().then(() => { console.info('Promise returned to indicate the session start success.'); }).catch((err: BusinessError) => { console.error(`Failed to start t...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function stopCaptureSession(captureSession: camera.CaptureSession): void { captureSession.stop((err: BusinessError) => { if (err) { console.error(`Failed to stop the session, error code: ${err.code}.`); return; } console.info('Callback in...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function stopCaptureSession(captureSession: camera.CaptureSession): void { captureSession.stop().then(() => { console.info('Promise returned to indicate the session stop success.'); }).catch((err: BusinessError) => { console.error(`Failed to stop the s...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function releaseCaptureSession(captureSession: camera.CaptureSession): void { captureSession.release((err: BusinessError) => { if (err) { console.error(`Failed to release the CaptureSession instance, error code: ${err.code}.`); return; } ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function releaseCaptureSession(captureSession: camera.CaptureSession): void { captureSession.release().then(() => { console.info('Promise returned to indicate that the CaptureSession instance is released successfully.'); }).catch((err: BusinessError) => { ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function hasFlash(captureSession: camera.CaptureSession): boolean { let status: boolean = false; try { status = captureSession.hasFlash(); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as Busin...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function isFlashModeSupported(captureSession: camera.CaptureSession): boolean { let status: boolean = false; try { status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO); } catch (error) { // If the operation fails, error.code...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setFlashMode(captureSession: camera.CaptureSession): void { try { captureSession.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as Business...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getFlashMode(captureSession: camera.CaptureSession): camera.FlashMode | undefined { let flashMode: camera.FlashMode | undefined = undefined; try { flashMode = captureSession.getFlashMode(); } catch (error) { // If the operation fails, error....
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function isExposureModeSupported(captureSession: camera.CaptureSession): boolean { let isSupported: boolean = false; try { isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED); } catch (error) { // If the ope...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getExposureMode(captureSession: camera.CaptureSession): camera.ExposureMode | undefined { let exposureMode: camera.ExposureMode | undefined = undefined; try { exposureMode = captureSession.getExposureMode(); } catch (error) { // If the opera...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setExposureMode(captureSession: camera.CaptureSession): void { try { captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED); } catch (error) { // If the operation fails, error.code is returned and processed. let err = err...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getMeteringPoint(captureSession: camera.CaptureSession): camera.Point | undefined { let exposurePoint: camera.Point | undefined = undefined; try { exposurePoint = captureSession.getMeteringPoint(); } catch (error) { // If the operation fails...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setMeteringPoint(captureSession: camera.CaptureSession): void { const point: camera.Point = {x: 1, y: 1}; try { captureSession.setMeteringPoint(point); } catch (error) { // If the operation fails, error.code is returned and processed. le...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getExposureBiasRange(captureSession: camera.CaptureSession): Array<number> { let biasRangeArray: Array<number> = []; try { biasRangeArray = captureSession.getExposureBiasRange(); } catch (error) { // If the operation fails, error.code is ret...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setExposureBias(captureSession: camera.CaptureSession, biasRangeArray: Array<number>): void { if (biasRangeArray && biasRangeArray.length > 0) { let exposureBias = biasRangeArray[0]; try { captureSession.setExposureBias(exposureBias); ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getExposureValue(captureSession: camera.CaptureSession): number { const invalidValue: number = -1; let exposureValue: number = invalidValue; try { exposureValue = captureSession.getExposureValue(); } catch (error) { // If the operation fai...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function isFocusModeSupported(captureSession: camera.CaptureSession): boolean { let status: boolean = false; try { status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO); } catch (error) { // If the operation fails, error.code...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setFocusMode(captureSession: camera.CaptureSession): void { try { captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO); } catch (error) { // If the operation fails, error.code is returned and processed. let err = error as Business...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getFocusMode(captureSession: camera.CaptureSession): camera.FocusMode | undefined { let afMode: camera.FocusMode | undefined = undefined; try { afMode = captureSession.getFocusMode(); } catch (error) { // If the operation fails, error.code i...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setFocusPoint(captureSession: camera.CaptureSession): void { const focusPoint: camera.Point = {x: 1, y: 1}; try { captureSession.setFocusPoint(focusPoint); } catch (error) { // If the operation fails, error.code is returned and processed. ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getFocusPoint(captureSession: camera.CaptureSession): camera.Point | undefined { let point: camera.Point | undefined = undefined; try { point = captureSession.getFocusPoint(); } catch (error) { // If the operation fails, error.code is return...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getFocalLength(captureSession: camera.CaptureSession): number { const invalidValue: number = -1; let focalLength: number = invalidValue; try { focalLength = captureSession.getFocalLength(); } catch (error) { // If the operation fails, erro...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getZoomRatioRange(captureSession: camera.CaptureSession): Array<number> { let zoomRatioRange: Array<number> = []; try { zoomRatioRange = captureSession.getZoomRatioRange(); } catch (error) { // If the operation fails, error.code is returned ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setZoomRatio(captureSession: camera.CaptureSession, zoomRatioRange: Array<number>): void { if (zoomRatioRange === undefined || zoomRatioRange.length <= 0) { return; } let zoomRatio = zoomRatioRange[0]; try { captureSession.setZoomRatio(zoo...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getZoomRatio(captureSession: camera.CaptureSession): number { const invalidValue: number = -1; let zoomRatio: number = invalidValue; try { zoomRatio = captureSession.getZoomRatio(); } catch (error) { // If the operation fails, error.code i...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function isVideoStabilizationModeSupported(captureSession: camera.CaptureSession): boolean { let isSupported: boolean = false; try { isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF); } catch (error) { ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function getActiveVideoStabilizationMode(captureSession: camera.CaptureSession): camera.VideoStabilizationMode | undefined { let vsMode: camera.VideoStabilizationMode | undefined = undefined; try { vsMode = captureSession.getActiveVideoStabilizationMode();...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function setVideoStabilizationMode(captureSession: camera.CaptureSession): void { try { captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF); } catch (error) { // If the operation fails, error.code is returned and processed. ...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function registerFocusStateChange(captureSession: camera.CaptureSession): void { captureSession.on('focusStateChange', (err: BusinessError, focusState: camera.FocusState) => { if (err !== undefined && err.code !== 0) { console.error(`Callback Error, er...
application-dev\reference\apis-camera-kit\js-apis-camera.md
function unregisterFocusStateChange(captureSession: camera.CaptureSession): void { captureSession.off('focusStateChange'); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function registerCaptureSessionError(captureSession: camera.CaptureSession): void { captureSession.on('error', (error: BusinessError) => { console.error(`Capture session error code: ${error.code}`); }); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
function unregisterCaptureSessionError(captureSession: camera.CaptureSession): void { captureSession.off('error'); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; import { colorSpaceManager } from '@kit.ArkGraphics2D'; function getSupportedColorSpaces(session: camera.PhotoSession): Array<colorSpaceManager.ColorSpace> { let colorSpaces: Array<colorSpaceManager.ColorSpace> = []; colorSpaces = session.getSupportedColorSpac...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; import { colorSpaceManager } from '@kit.ArkGraphics2D'; function setColorSpace(session: camera.PhotoSession, colorSpaces: Array<colorSpaceManager.ColorSpace>): void { if (colorSpaces === undefined || colorSpaces.length <= 0) { return; } try { session...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; import { colorSpaceManager } from '@kit.ArkGraphics2D'; function getActiveColorSpace(session: camera.PhotoSession): colorSpaceManager.ColorSpace | undefined { let colorSpace: colorSpaceManager.ColorSpace | undefined = undefined; try { colorSpace = session....
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function isAutoDeviceSwitchSupported(session: camera.PhotoSession): boolean { let isSupported = false; isSupported = session.isAutoDeviceSwitchSupported(); return isSupported; }
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function enableAutoDeviceSwitch(session: camera.PhotoSession, isEnable: boolean): void { try { session.enableAutoDeviceSwitch(isEnable); } catch (error) { let err = error as BusinessError; console.error(`The enableAutoDeviceSwitch call failed, erro...
application-dev\reference\apis-camera-kit\js-apis-camera.md
function testCanPreconfig(photoSession: camera.PhotoSession, preconfigType: camera.PreconfigType, preconfigRatio: camera.PreconfigRatio): void { try { let result = photoSession.canPreconfig(preconfigType, preconfigRatio); console.info(`canPreconfig ${preconfigType} ${preconfigRatio} result is : ${result}`);...
application-dev\reference\apis-camera-kit\js-apis-camera.md
function testPreconfig(photoSession: camera.PhotoSession, preconfigType: camera.PreconfigType, preconfigRatio: camera.PreconfigRatio): void { try { photoSession.preconfig(preconfigType, preconfigRatio); console.info(`preconfig ${preconfigType} ${preconfigRatio} success`); } catch (error) { let err = e...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function callback(err: BusinessError): void { console.error(`Photo session error code: ${err.code}`); } function registerSessionError(photoSession: camera.PhotoSession): void { photoSession.on('error', callback); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
function unregisterSessionError(photoSession: camera.PhotoSession): void { photoSession.off('error'); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function callback(err: BusinessError, focusState: camera.FocusState): void { if (err !== undefined && err.code !== 0) { console.error(`Callback Error, errorCode: ${err.code}`); return; } console.info(`Focus state: ${focusState}`); } function registe...
application-dev\reference\apis-camera-kit\js-apis-camera.md
function unregisterFocusStateChange(photoSession: camera.PhotoSession): void { photoSession.off('focusStateChange'); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void { if (err !== undefined && err.code !== 0) { console.error(`Callback Error, errorCode: ${err.code}`); return; } console.info(`The duration of smooth zoom: ${smoothZoom...
application-dev\reference\apis-camera-kit\js-apis-camera.md
function unregisterSmoothZoomInfo(photoSession: camera.PhotoSession): void { photoSession.off('smoothZoomInfoAvailable'); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function callback(err: BusinessError, autoDeviceSwitchStatus: camera.AutoDeviceSwitchStatus): void { if (err !== undefined && err.code !== 0) { console.error(`Callback Error, errorCode: ${err.code}`); return; } console.info(`isDeviceSwitched: ${autoD...
application-dev\reference\apis-camera-kit\js-apis-camera.md
function unregisterSmoothZoomInfo(photoSession: camera.PhotoSession): void { photoSession.off('autoDeviceSwitchStatusChange'); }
application-dev\reference\apis-camera-kit\js-apis-camera.md
function testCanPreconfig(videoSession: camera.VideoSession, preconfigType: camera.PreconfigType, preconfigRatio: camera.PreconfigRatio): void { try { let result = videoSession.canPreconfig(preconfigType, preconfigRatio); console.info(`canPreconfig ${preconfigType} ${preconfigRatio} result is : ${result}`);...
application-dev\reference\apis-camera-kit\js-apis-camera.md
function testPreconfig(videoSession: camera.VideoSession, preconfigType: camera.PreconfigType, preconfigRatio: camera.PreconfigRatio): void { try { videoSession.preconfig(preconfigType, preconfigRatio); console.info(`preconfig ${preconfigType} ${preconfigRatio} success`); } catch (error) { let err = e...
application-dev\reference\apis-camera-kit\js-apis-camera.md
import { BusinessError } from '@kit.BasicServicesKit'; function callback(err: BusinessError): void { console.error(`Video session error code: ${err.code}`); } function registerSessionError(videoSession: camera.VideoSession): void { videoSession.on('error', callback); }