-
Add
onScanFrameData
option 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 chosenimageConversion
format: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: false
option is used, then this callback is called for each successive scan.
- Adjust minimum allowed local scanning intervals.
- Add
idealWidth
andidealHeight
options to adjust the request for video stream constraints. - Add
onScanValue
callback option, to be used whenautoStop
isfalse
to receive scan values instead of via promise resolution.
- Reduce objects allocated on each invocation and on each frame.
- Clean up
README.md
and 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
identifiers
will be done and a Thng or product included in the results.See the
test/zxing-test-app
directory for a full usable example.
- Tidy up example apps
- Tidy up feature tests
- Improve
README.md
-
Updated the integration with Digimarc
discover.js
to use the latest version of the library (v1.0.0), if configured to do so and the library files are included first. -
onWatermarkDetected
now 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
useDiscover
option to enable client-side Digimarc watermark sensing, if the library is also made available. - Add
onWatermarkDetected
option to get called when the detection state changes. - Add
imageConversion.cropPercent
option to square crop some of the sent frame whenuseDiscover
istrue
. - Add
downloadFrames
option to prompt file download for frames sent to the API. - Add
setTorchEnabled
to enable the torch, on supported devices, while the video stream is open. - When
method
isdigimarc
, autoselectimageConversion
options if not already specified.
- Replace
MegaPixImage
dependency with native canvas scaling. - Update default remote image frame send interval to 1500ms.
- Add new
discover-test-app
. - Rework
stream.js
so that the same post-compression image data is given to discover and the API. - Apply
eslint
witheslint-config-airbnb
where 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:
Operator
SDK scopes can be used as well as Application scopes.
When using with
Operator
, thecreateAnonymousUser
option 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 acceptsinterval
which 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.js
by 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:
implicitScans
are not created automatically when scanning an image. - Options:
type
,timeout
,threshold
,redirect
,createScanAction
andspinner
options have been removed. See README for more information on how to use custom spinner.
- Options: Use
filter
option to filter out results based onmethod
andtype
app.scan({
filter: {
type: 'image'
}
});
- Options: Use
debug
option to include debug information in response. - Options: Use
perPage
option to specify max number of matches in response. - identify:
.identify
method 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
,datamatrix
andautodetect
types. - Timing: Adds timing and type information to the created scan action.
- Options: Send
threshold
param to server regardless of recognition type.
- Prepare options: Allow to specify imageConversion options on setup.
- Options: Supports new scanning engine. Added additional scan types
datamatrix
andautodetect
.
- Format: Convert image to same format as the original file.
- Scan plugin: When
createScanAction
option is set, we return theredirectionContext
andredirectUrl
found 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.