4

I am experimenting with the Web Midi API in Chrome/OS X. So far I get good results but I am wondering:

Is there a way to detect if a MIDI interface is connected/disconnected WHILE an application is running?

The way it works for now is to restart the browser to let the application know that an interface is present or not ...

There seems to be a MIDIAccess onconnect / ondisconnect event but I don't know what to do to make them fire. Is this implemented yet in Chrome (Canary)?

Shannon Matthews
  • 9,649
  • 7
  • 44
  • 75
solitud
  • 683
  • 5
  • 15

1 Answers1

7

The current implementation in Chrome has two shortcomings - it requires the browser to be rebooted to detect device changes, and it doesn't yet support the connect/disconnect events. Both of those problems will be fixed, but right now, you can't do what you're trying to do. (AKA - you're understanding the spec correctly, but Chrome just doesn't do that yet. :)

UPDATE MAY 2015: Chrome 43 supports both of these properly, so as of version 43 you should be able to have these work as specified.

cwilso
  • 13,610
  • 1
  • 30
  • 35
  • 1
    I thought it will be something like that, things just need some time. Thanks for helping me over and over again, btw, this is my project I need all this stuff for: http://modulargrid.net/e/racks/synth – solitud Oct 24 '13 at 21:41
  • 1
    @cwilso This explains the problem I reported in http://stackoverflow.com/questions/23200972/how-to-discover-midi-keyboard-in-web-midi-api . Will the default handlers for connect/disconnect automatically update existing MIDIAccess objects when the spec is fully implemented? Thanks for your work on this. It looks very promising. – Mike Ellis Apr 22 '14 at 12:45
  • yes, existing MIDIAccess objects should be dynamically updated. – cwilso Apr 23 '14 at 17:36
  • After 18 months, we still need to relaunch Chrome to detect new MIDI devices... Some progress on that issue ? – Pierre De Wilde Apr 07 '15 at 19:11
  • 3
    You don't need to relaunch Chrome anymore - Chrome 43 (Canary/dev channel) has the connection events implemented, and supports hot-plugging devices. – cwilso Apr 08 '15 at 20:50
  • A link to the API usage would be great here. – Stephane May 30 '19 at 14:30