In order for the end user to access scanning functionality, the Scandit library needs to be downloaded from the server and then initialized in the browser. The speed with which this can happen is dependent on both the speed of the internet connection (for download of ~1MB library) and on the processing power of the device (for initialization).
By default, the library is cached in the browser (browser and server permitting) and does not need to be redownloaded to the browser.
The library is then compiled, cached and loaded into memory to be used. The library must be loaded from cache on each page where it is to be used. Depending on the device, the compilation and the loading processes can take some time.
For single page webapps, the user experience will be better: after initial loading, the scanner will be readily available on different "pages" of the app, as it doesn't need to be retrieved from memory.
We recommend the following approaches to minimize perceived waiting time for the user.
- Re-use `BarcodePicker` objects whenever possible by hiding and showing them instead of destroying and recreating them: each object needs to load and initialize the external library on creation.
- If possible, create a (hidden and paused) `BarcodePicker` in the background and simply resume scanning switching its visibility to "show" when needed instead of creating it on the fly to provide instant scanning capabilities.
- Load and compile the library as soon as page with scanning functionality is loaded and ideally before the user has requested access to the scanner.
- To avoid any perception of wait time, hide the UI for scanning until the scanner is ready.
- If above are not viable options, animate the loading indicator in a customer-friendly / entertaining manner.