Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/94#discussion_r30210599
  
    --- Diff: src/windows/CameraProxy.js ---
    @@ -337,28 +336,48 @@ function takePictureFromCameraWP(successCallback, 
errorCallback, args) {
                     }
                 });
     
    -            capture.initializeAsync(captureSettings).done(function () {
    -                // 
msdn.microsoft.com/en-us/library/windows/apps/hh452807.aspx
    -                capturePreview.msZoom = true;
    -                capturePreview.src = URL.createObjectURL(capture);
    -                capturePreview.play();
    +            captureSettings.photoCaptureSource = 
Windows.Media.Capture.PhotoCaptureSource.photo;
     
    -                // Insert preview frame and controls into page
    -                document.body.appendChild(capturePreview);
    -                document.body.appendChild(captureCancelButton);
    +            return capture.initializeAsync(captureSettings);
    +        }).then(function () {
    +            // msdn.microsoft.com/en-us/library/windows/apps/hh452807.aspx
    +            capturePreview.msZoom = true;
    +            capturePreview.src = URL.createObjectURL(capture);
    +            capturePreview.play();
     
    -                // Bind events to controls
    -                window.addEventListener('deviceorientation', 
cameraPreviewOrientation, false);
    -                capturePreview.addEventListener('click', captureAction);
    -                captureCancelButton.addEventListener('click', function () {
    -                    destroyCameraPreview();
    -                    errorCallback('Cancelled');
    -                }, false);
    -            }, function (err) {
    +            // Insert preview frame and controls into page
    +            document.body.appendChild(capturePreview);
    +            document.body.appendChild(captureCancelButton);
    +
    +            // Bind events to controls
    +            window.addEventListener('deviceorientation', 
cameraPreviewOrientation, false);
    +            capturePreview.addEventListener('click', captureAction);
    +            captureCancelButton.addEventListener('click', function () {
                     destroyCameraPreview();
    -                errorCallback('Camera intitialization error ' + err);
    -            });
    -        }, errorCallback);
    +                errorCallback('Cancelled');
    +            }, false);
    +
    +            // Get available aspect ratios
    +            var aspectRatios = getAspectRatios(capture);
    +
    +            // Couldn't find a good ratio
    +            if (aspectRatios.length === 0) {
    +                destroyCameraPreview();
    +                errorCallback('There\'s not a good aspect ratio 
available');
    +                return;
    +            }
    +
    +            // Default aspect ratio 1.78 (16:9 hd video standard)
    +            if (aspectRatios.indexOf("1.8") > -1) {
    --- End diff --
    
    IMO it will be better to use constant here instead: `DEFAULT_ASPECT_RATIO = 
1.8`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to