webmidi icon indicating copy to clipboard operation
webmidi copied to clipboard

webmidi on android/IOS ?

Open ryodes opened this issue 2 years ago • 4 comments

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.

ryodes avatar Sep 07 '22 17:09 ryodes

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.

djipco avatar Sep 07 '22 20:09 djipco

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.

ryodes avatar Sep 08 '22 13:09 ryodes

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.

djipco avatar Sep 08 '22 13:09 djipco

ok i will try it, thanks

ryodes avatar Sep 08 '22 14:09 ryodes

Did you ever get this problem resolved?

djipco avatar Nov 17 '22 15:11 djipco

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"

image

but it works fine on pc

ryodes avatar Nov 28 '22 15:11 ryodes

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

djipco avatar Nov 28 '22 15:11 djipco

Did you resolve this issue?

djipco avatar Dec 15 '22 20:12 djipco

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 :)

ryodes avatar Dec 15 '22 20:12 ryodes