Question

I am trying to use MIDI.js to play sounds in the browser. https://github.com/mudcube/MIDI.js

It works in the chrome browser on one of my computers, but not on my other one (which is a chromebook), or on the chrome browser on two of my friends computers.

it prints to the console

"uh-oh! Something went wrong! Error code: 1" MIDI.js:349

which refers to this part of MIDI.js

navigator.requestMIDIAccess(function (access) {
        plugin = access;
        output = plugin.getOutput(0);
        if (callback) callback();
    }, function (err) {
        console.log("uh-oh! Something went wrong!  Error code: " + err.code );
    });

i found this post which seems to be referring to the problem i'm experiencing but i'm not quite sure

https://plus.google.com/+ChrisWilson/posts/cs4J6sS9qmJ

where it says to swap some parts of the code for some reason I couldn't understand

navigator.requestMIDIAccess( successCallback, failureCallback );

becomes:

navigator.requestMIDIAccess().then( successCallback, failureCallback );

but after replacing that part on MIDI.js 344, i get the error message

Uncaught TypeError: Cannot call method 'then' of undefined

Any help on how to fix this problem so it works in all browsers, or at least all chrome browsers, would be greatly appreciated. Thankyou

Was it helpful?

Solution

Chromebooks don't have Web MIDI API support yet (nor on Mac or Windows if you don't enable it, or Windows if you're not running Canary).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top