Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web MIDI API not implemented in Chrome Canary?

Support for the Web MIDI API has been added to Chrome Canary since early 2013.

Why then, when I type requestMIDIAccess in the JavaScript console and hit enter, do I get "ReferenceError: requestMIDIAccess is not defined"?

According to official documentation, it should be a defined function.

What gives?

like image 571
Joncom Avatar asked Feb 13 '23 18:02

Joncom


1 Answers

The Web MIDI API is available by default only in Chrome versions 43 and newer.

In earlier versions it is not enabled by default, but can be enabled as an experimental feature flag. In Chrome, load the special URL chrome://flags and search within the page for "Enable Web MIDI API".

The options on the flags page require the browser to be restarted before they will take effect. The features hidden behind these flags are in an experimental state and are subject to change at any time, so the API in older versions may differ from what is available in Chrome 43.

Note also that the requestMIDIAccess function is a method of window.navigator, not directly of window. Therefore you need to call it as navigator.requestMIDIAccess.

like image 188
Martin Atkins Avatar answered Feb 24 '23 03:02

Martin Atkins