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
});Navigator: requestMIDIAccess() method / notebook
Navigator: requestMIDIAccess() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
navigator.requestMIDIAccess().then((access) => {
// Get lists of available MIDI controllers
const inputs = access.inputs.values();
const outputs = access.outputs.values();
// …
});