The general rule is the following:
-
Low battery consumption is not a key requirement:
- pause scanning + hide related html container (captureMode.isEnabled=false +
using CSS in order to hide it
) -
resume scanning + show the html container (captureMode.isEnabled=true +
using CSS in order to show it
)
- pause scanning + hide related html container (captureMode.isEnabled=false +
-
Low battery consumption is a key requirement (and scanner is not used very often):
-
pause scanning and stop camera screen + hide related html container (barcodeCapture.isEnabled=false; camera.switchToDesiredState(Scandit.FrameSourceState.Off) +
using CSS in order to show it
) -
resume scanning (camera access will be reaccessed when needed) + show the html container (barcodeCapture.isEnabled=true; camera.switchToDesiredState(Scandit.FrameSourceState.On) +
using CSS in order to show it
)
-
-
When needed (not recommended if not really required):
-
Completely clear the context and then dispose it (removeAllModes() + dispose())
- Recreate the context when needed (create())
-
WebSDK 5.X(Legacy)
Please note that the destroy
method should only be used if needed as it removes all HTML elements added to the page, destroy the internal Scanner and the barcode picker itself; ensuring complete cleanup. This method should be called after you don't plan to use the picker anymore, before the object is automatically cleaned up by JavaScript. The barcode picker shouldn't be used in any way after this call.
We recommend reusing the existing picker and related HTML elements to achieve better loading time. More details can be also found here: https://support.scandit.com/hc/en-us/articles/115003182931-How-can-I-optimize-the-loading-time-of-the-Web-SDK-.
The general rule is the following:
-
Low battery consumption is not a key requirement:
- pause scanning + hide related html container (
pauseScanning
+setVisible(false)
) -
resume scanning + show the html container (
resumeScanning
+setVisible(true)
)
- pause scanning + hide related html container (
-
Low battery consumption is a key requirement (and scanner is not used very often):
-
pause scanning and stop camera screen + hide related html container (
pauseScanning(true)
+setVisible(false)
) -
resume scanning (camera access will be reaccessed when needed) + show the html container (
resumeScanning
+setVisible(true)
)
-
-
When needed (not recommended if not really required):