Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7C97E18DFA for ; Wed, 13 May 2015 17:35:01 +0000 (UTC) Received: (qmail 55459 invoked by uid 500); 13 May 2015 17:35:00 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 55451 invoked by uid 500); 13 May 2015 17:35:00 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 55372 invoked by uid 99); 13 May 2015 17:35:00 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2015 17:35:00 +0000 Date: Wed, 13 May 2015 17:35:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-8879) [Windows] Camera picture has black/green stripes that crop image MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-8879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14542285#comment-14542285 ] ASF GitHub Bot commented on CB-8879: ------------------------------------ Github user robpaveza commented on a diff in the pull request: https://github.com/apache/cordova-plugin-camera/pull/94#discussion_r30254781 --- 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 -- jshint rule violation: should be single quotes. > [Windows] Camera picture has black/green stripes that crop image > ---------------------------------------------------------------- > > Key: CB-8879 > URL: https://issues.apache.org/jira/browse/CB-8879 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin Camera > Affects Versions: 3.6.0 > Environment: windows > Reporter: Olivier VERMONT > Assignee: Murat Sutunc > Labels: camera, resolution, stripes, windows-phone-81 > > When a photo is taken with Windows Phone 8.1 device Nokia Lumia 735, the picture returned shows black or green stripes on the sides and is out of shape. It seems this is related to photo resolution but I can't get it fixed in JS. > It seems to be quite a common problem with the Media Capture API and people solved issue in C# here is an illustration : http://stackoverflow.com/questions/23709547/captured-photo-with-stripes > Here is what I tried without success : > var resolutions = capture.videoDeviceController.getAvailableMediaStreamProperties(Windows.Media.Capture.MediaStreamType.photo); > var maxWidth = 0; > var maxResolution = null; > for(var i=0; i //console.log(resolutions[i].width); > if(resolutions[i].width > maxResolution){ > maxWidth = resolutions[i].width; > maxResolution = resolutions[i]; > } > } > capture.videoDeviceController.setMediaStreamPropertiesAsync(Windows.Media.Capture.MediaStreamType.photo, maxResolution) > Am I missing something ? -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org