After getting the webmidi NPM package approved and installed, I am unable by importing in backend code, nor as a public js file, nor importing it directly to the frontend code. I receive the following error in each case:
Importing via backend:
import {enableMidi} from ‘backend/WebMidi’;
So for some reason the package is useable now, but WebMidi is not enabled when running a page code through Wix. I think its because a lot of the navigator DOM web apis are not accessible on Wix. Is there a work around to this? To clarify with examples the WebMidi NPM package can be installed and the functions called in it, but never enabled.
WebMidi.enable(function (err)){…} would return with “WebMidi could not be enabled. Error: The Web MIDI API is not supported by your browsers”
Where as:
if (navigator.requestMIDIAccess) {
console.log('This browser supports WebMIDI!');} else {
console.log('WebMIDI is not supported in this browser.');}
return the second message error because on wix velo coding navigator object does not have requestMIDIAccess.
Thanks @MVVeiga, but I meant how would I do it on Wix velo. Right now calling a require in the front end page code still gives me the same error. I’m going to try backend calls, but is there a proper standard that I should follow when doing this on Velo?