motiz88 / react-native-midi

[WIP] Web MIDI implementation for React Native using Expo Modules
MIT License
69 stars 1 forks source link

MIDI Inputs not listed in Android if not added via 'openBluetoothDevice(...)' #5

Open kimchouard opened 1 year ago

kimchouard commented 1 year ago

I just tested this library in iOS, and it works like a charm. ✨

I'm now trying in Android. When I run :

requestMIDIAccess().then((MIDIAccess) => {
  console.log('MIDI Inputs: ', MIDIAccess.inputs); 
  // (...)

It returns an empty map, although the saxophone is connected via Bluetooth.

Any thoughts why? Is there any extra step more than connecting the Bluetooth device that is required in Android to "register" it as a MIDI device? 🤔

Thanks in advance 🙌

kimchouard commented 1 year ago

Alright, it seems like there is a special openBluetoothDevice() function (in contrario of the official openDevice) that needs to be called to init a BTLE device to be listed as a MIDI device (see official android.media.midi spec, then it should be available for other app to use too: m.openBluetoothDevice(bluetoothDevice, callback, handler);

Now working on:

toBeContinued

motiz88 commented 1 year ago

This is by design and is discussed some more in #3. If there isn't a Web standard we can follow, my preference would be to create a separate package to provide an API for cross-platform BLE MIDI setup.