phonegap-plugin-barcodescanner
Advanced tools
Comparing version 6.0.1 to 6.0.2
{ | ||
"name": "phonegap-plugin-barcodescanner", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "You can use the BarcodeScanner plugin to scan different types of barcodes (using the device's camera) and get the metadata encoded in them for processing within your application.", | ||
@@ -42,3 +42,10 @@ "cordova": { | ||
}, | ||
"homepage": "https://github.com/phonegap/phonegap-plugin-barcodescanner#readme" | ||
"homepage": "https://github.com/phonegap/phonegap-plugin-barcodescanner#readme", | ||
"scripts": { | ||
"test": "jasmine-node --color spec" | ||
}, | ||
"devDependencies": { | ||
"jasmine-node": "1.14.5", | ||
"pluginpub": "^0.0.5" | ||
} | ||
} |
@@ -8,7 +8,7 @@ # PhoneGap Plugin BarcodeScanner | ||
Follows the [Cordova Plugin spec](http://cordova.apache.org/docs/en/5.0.0/plugin_ref_spec.md), so that it works with [Plugman](https://github.com/apache/cordova-plugman). | ||
Follows the [Cordova Plugin spec](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html), so that it works with [Plugman](https://github.com/apache/cordova-plugman). | ||
## Installation | ||
This requires phonegap 5.0+ ( current stable v3.0.0 ) | ||
@@ -46,2 +46,13 @@ | ||
Note: Since iOS 10 it's mandatory to add a `NSCameraUsageDescription` in the info.plist. | ||
`NSCameraUsageDescription` describes the reason that the app accesses the user’s camera. | ||
When the system prompts the user to allow access, this string is displayed as part of the dialog box. | ||
To add this entry you can pass the following variable on plugin install. | ||
``` | ||
cordova plugin add phonegap-plugin-barcodescanner --variable CAMERA_USAGE_DESCRIPTION="To scan barcodes" | ||
``` | ||
### PhoneGap Build | ||
@@ -51,3 +62,3 @@ If you're using [PhoneGap Build](https://build.phonegap.com/) please make sure you specify `gradle` as your Android build tool in `config.xml`: `<preference name="android-build-tool" value="gradle" />`. | ||
## Using the plugin ## | ||
The plugin creates the object `cordova/plugin/BarcodeScanner` with the method `scan(success, fail)`. | ||
The plugin creates the object `cordova/plugin/BarcodeScanner` with the method `scan(success, fail)`. | ||
@@ -144,3 +155,3 @@ The following barcode types are currently supported: | ||
"Cancelled: " + result.cancelled); | ||
}, | ||
}, | ||
function (error) { | ||
@@ -161,3 +172,3 @@ alert("Scanning failed: " + error); | ||
The plugin creates the object `cordova.plugins.barcodeScanner` with the method `encode(type, data, success, fail)`. | ||
The plugin creates the object `cordova.plugins.barcodeScanner` with the method `encode(type, data, success, fail)`. | ||
@@ -194,3 +205,3 @@ Supported encoding types: | ||
So many -- check out the original [iOS](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/iOS/BarcodeScanner), [Android](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/Android/BarcodeScanner) and | ||
So many -- check out the original [iOS](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/iOS/BarcodeScanner), [Android](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/Android/BarcodeScanner) and | ||
[BlackBerry 10](https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10-Cordova/BarcodeScanner) repos. | ||
@@ -197,0 +208,0 @@ |
@@ -158,2 +158,3 @@ /* | ||
this._zxingReader = new ZXing.BarcodeReader(); | ||
this._zxingReader.tryHarder = true; | ||
}; | ||
@@ -347,4 +348,10 @@ | ||
// Multiple calls to focusAsync leads to internal focusing hang on some Windows Phone 8.1 devices | ||
if (controller.focusControl.focusState === Windows.Media.Devices.MediaCaptureFocusState.searching) { | ||
return result; | ||
// Also need to wrap in try/catch to avoid crash on Surface 3 - looks like focusState property | ||
// somehow is not accessible there. See https://github.com/phonegap/phonegap-plugin-barcodescanner/issues/288 | ||
try { | ||
if (controller.focusControl.focusState === Windows.Media.Devices.MediaCaptureFocusState.searching) { | ||
return result; | ||
} | ||
} catch (e) { | ||
// Nothing to do - just continue w/ focusing | ||
} | ||
@@ -404,3 +411,3 @@ | ||
// Continuous focus should start only after preview has started. See 'Remarks' at | ||
// Continuous focus should start only after preview has started. See 'Remarks' at | ||
// https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.devices.focuscontrol.configure.aspx | ||
@@ -450,3 +457,3 @@ function waitForIsPlaying() { | ||
var controller = capture.videoDeviceController; | ||
var deviceProps = controller.getAvailableMediaStreamProperties(Windows.Media.Capture.MediaStreamType.videoRecord); | ||
var deviceProps = controller.getAvailableMediaStreamProperties(Windows.Media.Capture.MediaStreamType.videoPreview); | ||
@@ -462,4 +469,11 @@ deviceProps = Array.prototype.slice.call(deviceProps); | ||
var maxResProps = deviceProps[0]; | ||
return controller.setMediaStreamPropertiesAsync(Windows.Media.Capture.MediaStreamType.videoRecord, maxResProps) | ||
var preferredProps = deviceProps.filter(function(prop){ | ||
// Filter out props where frame size is between 640*480 and 1280*720 | ||
return prop.width >= 640 && prop.height >= 480 && prop.width <= 1280 && prop.height <= 720; | ||
}); | ||
// prefer video frame size between between 640*480 and 1280*720 | ||
// use maximum resolution otherwise | ||
var maxResProps = preferredProps[0] || deviceProps[0]; | ||
return controller.setMediaStreamPropertiesAsync(Windows.Media.Capture.MediaStreamType.videoPreview, maxResProps) | ||
.then(function () { | ||
@@ -466,0 +480,0 @@ return { |
@@ -10,3 +10,3 @@ /** | ||
var exec = require("cordova/exec"); | ||
var exec = cordova.require("cordova/exec"); | ||
@@ -13,0 +13,0 @@ var scanInProgress = false; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6518814
76
1820
226
2
4