diff --git a/validator/acts_validator/src/main/ets/pages/model/CameraService.ts b/validator/acts_validator/src/main/ets/pages/model/CameraService.ts index 194e5c1a4e0137e276950b6a5d4e7e4956a358c3..3168b2a9dcead17048755dc515bf00fc5de1433c 100644 --- a/validator/acts_validator/src/main/ets/pages/model/CameraService.ts +++ b/validator/acts_validator/src/main/ets/pages/model/CameraService.ts @@ -141,12 +141,14 @@ class CameraService { this.videoConfig.videoSourceType = 0 } Logger.info(this.tag, `cameraDeviceIndex success: ${cameraDeviceIndex}`) - previewObj.format = this.cameraOutputCapability.previewProfiles[0].format - Logger.info(this.tag, `previewObj format: ${previewObj.format}`) await this.releaseCamera() await this.getCameraManagerFn() await this.getSupportedCamerasFn() await this.getSupportedOutputCapabilityFn(cameraDeviceIndex) + if (previewObj){ + previewObj.format = this.cameraOutputCapability.previewProfiles[0].format + Logger.info(this.tag, `previewObj format: ${previewObj.format}`) + } await this.createPreviewOutputFn(previewObj ? previewObj : this.cameraOutputCapability.previewProfiles[0], surfaceId) // await this.createPhotoOutputFn(this.photoProfileObj) await this.createPhotoOutputFn(obj ? obj : this.cameraOutputCapability.photoProfiles[photoIndex?photoIndex:0])