Search code examples
macosgoogle-chromeweb-midi

The Web MIDI API is not supported by your browser - Google Chrome on Mac - when code is run locally


Folks,

I am trying work on a simple Web MIDI app.

I already looked up and found out that Google Chrome is the only browser that supports this. So, I installed this but I still get this.

WebMidi could not be enabled Error: The Web MIDI API is not supported by your browser. at WebMidi.enable (webmidi.min.js:30) at script.js:430 (anonymous) @ script.js:432 WebMidi.enable @ webmidi.min.js:30 (anonymous) @ script.js:430 Promise.then (async) (anonymous) @ script.js:154

Mac - 10.15.2 Chrome - 79.0.3945.117

According to this link - https://www.midi.org/17-the-mma/99-web-midi , Chrome definitely has the support.

Important Note - If I were run the code directly on codepen, it works just fine. So the browser is working. But when I try to run locally, I get the error.

https://codepen.io/teropa/pen/JLjXGK

  WebMidi.enable(err => {
    if (err) {
      console.error('WebMidi could not be enabled', err);
      return;
    }

What am I missing here? is this a chrome issue or Mac issue or some permission issue. Or, is there is something specific I need to make the MIDI code run locally?

I am using this server, https://www.npmjs.com/package/http-server, to run the code locally.

(I have looked at other questions but did not find anything that relates to Chrome on Mac)


Solution

  • I've used web-midi with Chromium and Opera on 10.12.6, so I wouldn't say that Chrome is the only browser that has web-midi.

    With Opera I think I had to enable experimental features:

    chrome://flags/#enable-experimental-web-platform-features
    

    Maybe see if Chrome needs that too? Or maybe it's just a side-effect of all the lock-down in 10.15?