RyanJ
RyanJ

Reputation: 131

Use the HTML5 web MIDI API

I'm trying to make a simple synth web-app using the web audio API and I want to use it with my MIDI keyboard through the web MIDI API, so I tried these instructions both on Chrome and Chrome Canary but always I get the "navigator.getMIDIAccess is not a function" error, the version is 40 for Chrome and 42 for Chrome Canary, both on Mac OS X (10.10.2) and the experimental flag has been enabled. The code for now is very simple (this is a test):

<script type="text/javascript">
try{
    //navigator.getMIDIAccess = ( navigator.getMIDIAccess || navigator.webkitGetMIDIAccess || navigator.mozGetMIDIAccess || navigator.msGetMIDIAccess);
    navigator.getMIDIAccess(_event_success, function(){
        alert("ERROR");
    });
}catch(ex){
    console.log(ex);
    alert("NOT SUPPORTED");
}

function _event_success(){
    console.log("OK");
}
</script>

Where is the error? If may be helpful I'm using a M-AUDIO Keystation88 keyboard on USB. Is Chrome the only one that suport this feature?

Upvotes: 0

Views: 773

Answers (1)

cwilso
cwilso

Reputation: 13908

The api call is "requestMIDIAccess". (It is not prefixed.)

Upvotes: 2

Related Questions