Skip to content

Android USB Midi hotplug - no midi received on reconnect #93

Description

@JBramauer

Setup:
AndroidMidiAccess
Google Pixel 8 with Android 15

Short description:
I need to connect to a device 2 times after USB unplug and replug before I receive data again.

Steps to reproduce the issue:

Part 1: Normal connect

  • Plug a USB MIDI device
  • connect via midiAccess.openInput and openOutput (returns a MidiInput/MidiOutput instance)
  • set listener on the input instance
  • Data is received. We're happy.

Part 2: unplug

  • Now unplug the device (we're listening to MidiAccess.stateChanged)
  • ports are not available anymore, cannot close the connection on our end, though, as the MidiInput/MidiOutput instances are already null

Part 3: re-plug and reconnect

  • Reconnect the USB device
  • we receive the state changed
  • connect again, we receive the correct device info and openInput returns a MidiInput instance
  • set listener on the input
  • listener does not receive anything

Part 4: try again - works

  • disconnect (close previous instance)
  • connect again
  • set listener
  • now we're receiving data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions