From e8ebc6ee9f6ed9729f66102cc22d464867a3d594 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 15 Nov 2023 15:44:19 +0100 Subject: [PATCH] chore: Move code --- package/src/devices/getCameraFormat.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/package/src/devices/getCameraFormat.ts b/package/src/devices/getCameraFormat.ts index 4dcae3b..4b202fa 100644 --- a/package/src/devices/getCameraFormat.ts +++ b/package/src/devices/getCameraFormat.ts @@ -123,9 +123,10 @@ export function getCameraFormat(device: CameraDevice, filters: FormatFilter[]): let leftPoints = 0 let rightPoints = 0 - const leftVideoResolution = bestFormat.videoWidth * bestFormat.videoHeight - const rightVideoResolution = format.videoWidth * format.videoHeight + // Video Resolution if (filter.videoResolution != null) { + const leftVideoResolution = bestFormat.videoWidth * bestFormat.videoHeight + const rightVideoResolution = format.videoWidth * format.videoHeight if (filter.videoResolution.target === 'max') { // We just want the maximum resolution if (leftVideoResolution > rightVideoResolution) leftPoints += filter.videoResolution.priority @@ -140,9 +141,10 @@ export function getCameraFormat(device: CameraDevice, filters: FormatFilter[]): } } - const leftPhotoResolution = bestFormat.photoWidth * bestFormat.photoHeight - const rightPhotoResolution = format.photoWidth * format.photoHeight + // Photo Resolution if (filter.photoResolution != null) { + const leftPhotoResolution = bestFormat.photoWidth * bestFormat.photoHeight + const rightPhotoResolution = format.photoWidth * format.photoHeight if (filter.photoResolution.target === 'max') { // We just want the maximum resolution if (leftPhotoResolution > rightPhotoResolution) leftPoints += filter.photoResolution.priority