Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-plugin-camera/pull/94#discussion_r30210477 --- Diff: src/windows/CameraProxy.js --- @@ -438,6 +457,61 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) { }); }; + var getAspectRatios = function (capture) { + var photoAspectRatios = capture.videoDeviceController.getAvailableMediaStreamProperties(Windows.Media.Capture.MediaStreamType.photo).map(function (element) { + return (element.width / element.height).toFixed(1); + }).filter(function (element, index, array) { if (index === array.indexOf(element)) return 1; return 0; }); + + var videoAspectRatios = capture.videoDeviceController.getAvailableMediaStreamProperties(Windows.Media.Capture.MediaStreamType.videoRecord).map(function (element) { + return (element.width / element.height).toFixed(1); + }).filter(function (element, index, array) { if (index === array.indexOf(element)) return 1; return 0; }); + + var videoPreviewAspectRatios = capture.videoDeviceController.getAvailableMediaStreamProperties(Windows.Media.Capture.MediaStreamType.videoPreview).map(function (element) { + return (element.width / element.height).toFixed(1); + }).filter(function (element, index, array) { if (index === array.indexOf(element)) return 1; return 0; }); + + var allAspectRatios = [].concat(photoAspectRatios, videoAspectRatios, videoPreviewAspectRatios); + + var aspectObj = allAspectRatios.reduce(function (map, item) { + if (!map[item]) { + map[item] = 0; + } + map[item]++; + return map; + }, {}); + + return Object.keys(aspectObj).filter(function (k) { + return aspectObj[k] === 3; --- End diff -- You are restricting aspect ratios to those which only supported by __all__ capture modes (picture, video and videoPreview). Not sure if it is by intent. Probably it makes sense to respect __current__ capture mode and return aspect ratios for this capture mode. Potentially there could be a situation when device's camera support a different aspect ratios for video and image capture. For example video is captured only in 640*480, which is equal to 1.3 aspect ratio, and for image there could be a number of other aspect ratios). This logic will return only '1.3' or even an empty set.
--- 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