EngstromJimmy / Blazm.Bluetooth

84 stars 14 forks source link

on subsequent reconnections / app restarts - I get this error #23

Open cn-johndpope opened 1 year ago

cn-johndpope commented 1 year ago

export async function requestDevice(query) { var objquery = JSON.parse(query); console.log(query);

var device = await navigator.bluetooth.requestDevice(objquery);
await device.gatt.connect();
device.addEventListener('gattserverdisconnected', onDisconnected);
PairedBluetoothDevices.push(device);
console.log('> Device connected');
return { "Name": device.name, "Id": device.id };

} DOMException: Failed to execute 'requestDevice' on 'Bluetooth': Must be handling a user gesture to show a permission request.

seems like the device is already paired???

Message= Source= StackTrace: at Module.requestDevice (https://localhost:7150/_content/Blazm.Bluetooth/Blazm.Bluetooth.js:6:44) at https://localhost:7150/_framework/blazor.webassembly.js:1:3337 at new Promise () at Object.beginInvokeJSFromDotNet (https://localhost:7150/_framework/blazor.webassembly.js:1:3311) at Object.Gt [as invokeJSFromDotNet] (https://localhost:7150/_framework/blazor.webassembly.js:1:62569) at Object.Ii (https://localhost:7150/_framework/dotnet.7.0.5.c8stfzu6s6.js:5:71974) at _mono_wasm_invoke_js_blazor (https://localhost:7150/_framework/dotnet.7.0.5.c8stfzu6s6.js:14:103886) at wasm://wasm/00992dae:wasm-function[313]:0x1d507 at wasm://wasm/00992dae:wasm-function[283]:0x1c935 at wasm://wasm/00992dae:wasm-function[221]:0xe025

this was not helpful - I will keep digging. https://stackoverflow.com/questions/70007274/what-is-must-be-handling-a-user-gesture-to-show-a-permission-request-errror-m