I have this code:
@page "/Skaner"
@inject IJSRuntime JS
@using BlazorBarcodeScanner.ZXing.JS
<BarcodeReader Title="Skanuj kod kreskowy"
StartCameraAutomatically="true"
ShowStart="true"
ShowReset="true"
ShowToggleTorch="true"
ShowVideoDeviceList="true"
VideoWidth="300"
VideoHeight="200"
OnBarcodeReceived="HandleBarcodeReceived" />
@code {
private void HandleBarcodeReceived(BarcodeReceivedEventArgs args)
{
// Przetwarzaj zeskanowany kod
Console.WriteLine($"Zeskanowany kod: {args.BarcodeText}");
// Możesz dodać logikę do wyświetlenia lub przetworzenia zeskanowanego kodu
}
}
Everything works when I run it on Windows.
Things get worse when I want to run it on Android because it says something like this: “Skanuj kod kreskowy
Can’t enumerate devices, method not supported. Error: Can’t enumerate devices, method not supported. at t.BrowserMultiFormatReader. (http://192.168.0.78:8082/_content/BlazorBarcodeScanner.ZXing.JS/zxingjs.index.min.js:15:28105) at Generator.next () at http://192.168.0.78:8082/_content/BlazorBarcodeScanner.ZXing.JS/zxingjs.index.min.js:15:27264 at new Promise () at P (http://192.168.0.78:8082/_content/BlazorBarcodeScanner.ZXing.JS/zxingjs.index.min.js:15:27009) at t.BrowserMultiFormatReader.listVideoInputDevices (http://192.168.0.78:8082/_content/BlazorBarcodeScanner.ZXing.JS/zxingjs.index.min.js:15:27944) at Object.listVideoInputDevices (http://192.168.0.78:8082/_content/BlazorBarcodeScanner.ZXing.JS/BlazorBarcodeScanner.js:92:77) at http://192.168.0.78:8082/_framework/blazor.server.js:1:3047 at new Promise () at y.beginInvokeJSFromDotNet (http://192.168.0.78:8082/_framework/blazor.server.js:1:3004”
The application is hosted by IIS in the Blazor Server architecture. I use it and their website, for example on Android, works, i.e. a window asking for permission to use the camera opens.
https://www.nuget.org/packages/BlazorBarcodeScanner.ZXing.JS/#readme-body-tab
https://www.nuget.org/packages/BlazorBarcodeScanner.ZXing.JS/#readme-body-tab
Any tips why it’s not working?
4