Closed ryodes closed 1 year ago
Are you getting the "WebMidi could not be enabled." message when you execute your code? If so, which browser are you using and on which platform?
By the way, the Web MIDI API is not supported by Safari. On iOS, Chrome uses Safari's engine (as per Apple's requirements). This prevents support for the Web MIDI API on Chrome/iOS.
I don't know what message I have on mobile, I can't open the element inspector, and for the browser, I'm using an android device with Chrome.
It should work on Chrome/Android. You can view error messages by using a remote debugging session. Once you know what error you are getting, it will be easier to help you.
ok i will try it, thanks
Did you ever get this problem resolved?
oops, sorry, I totally forgot to answer. yes i still have the problem on android. When I connect my android device to my piano, I get the message "No MIDI inputs"
but it works fine on pc
Can you see the device at the OS level? You can try this procedure to verify it: https://source.android.com/docs/core/audio/midi_test?hl=en
Did you resolve this issue?
no, but I have the impression that it's my piano which is not familiar with android webpacks, you can close this issue, I plan to make an application on mobile to test, thanks :)
Does webmidi work with android/IOS devices ?
I am experiencing some troubles using your API on mobile devices. It works perfectly fine for desktop users but on mobile it seems that WebMIDI can not be enabled.
Detail
WebMidi.enable((error) => { if (error) { console.warn("WebMidi could not be enabled."); return; } console.log("WebMidi enabled."); if (WebMidi.inputs.length === 0) { console.log("No MIDI inputs."); return; } const input = WebMidi.inputs[0]; input.addListener("noteon", "all", (event) => { this.handlePlayNoteInput(event.note.number); }); input.addListener("noteoff", "all", (event) => { this.handleStopNoteInput(event.note.number); }); });
here is my website with WebMidi: https://learn-chords.netlify.app/
Thank you.