-
Add
onScanFrameDataoption that allows an app to obtain an image of the video stream at the point in time a code was scanned, which can be useful for driving UIs. It accepts a callback function that is called with the base64 image data in the chosenimageConversionformat:const opts = { filter: { method, type }, containerId, onScanFrameData: (base64) => { // Show the frame at the point of decode img.src = base64; }, }; const res = await operator.scanStream(opts); console.log(res);
If the
autoStop: falseoption is used, then this callback is called for each successive scan.
- Adjust minimum allowed local scanning intervals.
- Add
idealWidthandidealHeightoptions to adjust the request for video stream constraints. - Add
onScanValuecallback option, to be used whenautoStopisfalseto receive scan values instead of via promise resolution.
- Reduce objects allocated on each invocation and on each frame.
- Clean up
README.mdand make the full list of options more readable.
-
Add ability to scan 1D barcodes locally with
zxing-js/browser, in addition to the already implemented local scanning of 2D barcodes withjsQR. To use, include the library and use the following options:<script type="text/javascript" src="https://unpkg.com/@zxing/browser@latest"></script>
const opts = { filter: { method: '1d', type: 'auto', }, containerId: SCANSTREAM_CONTAINER_ID, useZxing: true, }; const res = await operator.scanStream(opts); console.log(res);
If the scanned value has a mappable type to the EVRYTHNG Identifier Recognition API, the usual Thng/product lookup by
identifierswill be done and a Thng or product included in the results.See the
test/zxing-test-appdirectory for a full usable example.
- Tidy up example apps
- Tidy up feature tests
- Improve
README.md
-
Updated the integration with Digimarc
discover.jsto use the latest version of the library (v1.0.0), if configured to do so and the library files are included first. -
onWatermarkDetectednow passes the full result fromdiscover.js, not just the detected state.
Before this version:
operator.scanStream({
containerId,
filter,
useDiscover: true,
onWatermarkDetected: (detected) => console.log(`Watermark detected: ${detected}`),
}).then(console.log);After this version:
operator.scanStream({
containerId,
filter,
useDiscover: true,
onWatermarkDetected: (discoverResult) => {
const detected = discoverResult.watermark;
// x, y, width, height, rotation also available
console.log(discoverResult);
},
}).then(console.log);- Add
useDiscoveroption to enable client-side Digimarc watermark sensing, if the library is also made available. - Add
onWatermarkDetectedoption to get called when the detection state changes. - Add
imageConversion.cropPercentoption to square crop some of the sent frame whenuseDiscoveristrue. - Add
downloadFramesoption to prompt file download for frames sent to the API. - Add
setTorchEnabledto enable the torch, on supported devices, while the video stream is open. - When
methodisdigimarc, autoselectimageConversionoptions if not already specified.
- Replace
MegaPixImagedependency with native canvas scaling. - Update default remote image frame send interval to 1500ms.
- Add new
discover-test-app. - Rework
stream.jsso that the same post-compression image data is given to discover and the API. - Apply
eslintwitheslint-config-airbnbwhere there was no linter before.
-
ScanThng.convertToDataUrl: Provides functionality to read a user file into a data URL.
-
ScanThng.convertImageFormat: Pre-processs an image for QR decoding.
<input
id="file"
name="file"
type="file"
onChange={async event => {
const file = event.currentTarget.files[0];
const dataUrl = await ScanThng.convertToDataUrl(file);
const processedDataUrl = await ScanThng.convertImageFormat(
dataUrl,
{
imageConversion: {
exportFormat: 'image/jpeg',
exportQuality: 0.9,
greyscale: false,
resizeTo: 480,
},
},
);
console.log(processedDataUrl);
}}
/>
- Operator:
OperatorSDK scopes can be used as well as Application scopes.
When using with
Operator, thecreateAnonymousUseroption is not available.
const res = await operator.scanStream(opts);- scanStream:
app.scanStream()now acceptsimageConversion.
app.scanStream({
filter: { method: 'digimarc', type: 'gs1:21' },
containerId: 'stream_container',
imageConversion: {
greyscale: false,
exportFormat: 'image/jpeg',
resizeTo: 1080,
},
})
.then(console.log)
.catch(console.log);- scanStream:
app.scanStream()now acceptsintervalwhich changes its scan rate. The minimum interval for non-native scanning is 500ms.
app.scanStream({
filter: { method: '2d', type: 'qr_code' },
containerId: 'stream_container',
interval: 300,
})
.then(console.log)
.catch(console.log);- scanStream:
app.scanStream()can now be used to scan natively in the browser via thegetUserMedia()API, else falling back toapp.scan(). The app developer must includejsQR.jsby adding a<script>tag before us. The method adds a<video>element inside a container specified by the developer. A fast scan rate is used for local scanning of QR codes, and a slower one for all other code types (since more requests are made to the API).
app.scanStream({
filter: { method: '2d', type: 'qr_code' },
containerId: 'stream_container',
}).then(function (res) {
if (!res.length) {
console.log('Nothing found!');
return;
}
console.log(res[0].results[0].redirections[0]);
}).catch(console.log);
- implicitScans:
implicitScansare not created automatically when scanning an image. - Options:
type,timeout,threshold,redirect,createScanActionandspinneroptions have been removed. See README for more information on how to use custom spinner.
- Options: Use
filteroption to filter out results based onmethodandtype
app.scan({
filter: {
type: 'image'
}
});
- Options: Use
debugoption to include debug information in response. - Options: Use
perPageoption to specify max number of matches in response. - identify:
.identifymethod is now available on the app and allows to get Thng/product infromation associated with provided value:
app.identify({
filter: {
type: 'text',
value: 'value'
}
});
- redirect: Redirect to url provided
app.redirect('https://evrythng.com')
- Image resize: send larger images when using
qrcode,1dbarcode,datamatrixandautodetecttypes. - Timing: Adds timing and type information to the created scan action.
- Options: Send
thresholdparam to server regardless of recognition type.
- Prepare options: Allow to specify imageConversion options on setup.
- Options: Supports new scanning engine. Added additional scan types
datamatrixandautodetect.
- Format: Convert image to same format as the original file.
- Scan plugin: When
createScanActionoption is set, we return theredirectionContextandredirectUrlfound in the reaction of the created scan action are in the payload top level. It potentially overrides value obtained from the redirection.
- Prepare options: fixed bug when trying to process image without custom prepare options.
- Scan: Scanthng.js was converted to a plugin. This adds Product Recognition capabilities to any EVRYTHNG App.