This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The requestMIDIAccess() method of the Navigator interface returns a Promise representing a request for access to MIDI devices on a user's system. This method is part of the Web MIDI API, which provides a means for accessing, enumerating, and manipulating MIDI devices.
This method may prompt the user for access to MIDI devices available to their system, or it may use a previously established preference to grant or deny access. If permission is granted then the Promise resolves and a MIDIAccess object is returned.
requestMIDIAccess() requestMIDIAccess(MIDIOptions)
MIDIOptions OptionalAn Object representing options to pass into the method. These options are:
A Promise that resolves with a MIDIAccess object.
AbortError DOMException
Thrown if the document or page is closed due to user navigation.
InvalidStateError DOMException
Thrown if the underlying system raises any errors.
NotSupportedError DOMException
Thrown if the feature or options are not supported by the system.
SecurityError DOMException
Thrown if the user or system denies the application from creating a MIDIAccess object with the requested options, or if the document is not allowed to use the feature (for example, because of a Permission Policy, or because the user previously denied a permission request).
Access to the API is subject to the following constraints:
midi HTTP Permission Policy.The permission status can be queried using the Permissions API method navigator.permissions.query(), passing a permission descriptor with the midi permission and (optional) sysex property:
navigator.permissions.query({ name: "midi", sysex: true }).then((result) => {
if (result.state === "granted") {
// Access granted.
} else if (result.state === "prompt") {
// Using API will prompt for permission
}
// Permission was denied by user prompt or permission policy
});
In the following example, the Navigator.requestMIDIAccess() method returns the MIDIAccess object, which gives access to information about the input and output MIDI ports.
navigator.requestMIDIAccess().then((access) => {
// Get lists of available MIDI controllers
const inputs = access.inputs.values();
const outputs = access.outputs.values();
// …
});
| Specification |
|---|
| Web MIDI API> # dom-navigator-requestmidiaccess> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
requestMIDIAccess |
43 | 79 | 108API access is gated by installation of a site permission add-on (user prompt), secure context, andPermission Policy: midi. |
30 | No | 43 | No | 30 | No | 4.0 | 43 | No |
secure_context_required |
43 | 79 | 108 | 30 | No | 43 | No | 30 | No | 4.0 | 43 | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestMIDIAccess