Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do I trigger this in modern firefox? #9

Open
Pomax opened this issue May 20, 2022 · 5 comments
Open

how do I trigger this in modern firefox? #9

Pomax opened this issue May 20, 2022 · 5 comments

Comments

@Pomax
Copy link

Pomax commented May 20, 2022

If I use the following code to detect midi support on https://pomax.github.io/mini-daw/:

async function connectMIDI() {
  if (!navigator.requestMIDIAccess) {
    // Warn the user that they won't have MIDI functionality. Then load anyway
    alert(
      `WebMIDI is not supported (without plugins?) in this browser.\nYou can still play around, just... no MIDI functionality, obviously.`
    );
  } else {
    try {
      const result = await navigator.requestMIDIAccess();
      return onMidiSuccess(result);
    } catch (e) {
      onMidiFail();
    }
  }
}

then the jazz midi plugin does not appear to kick in using current Firefox.

@jazz-soft
Copy link
Owner

jazz-midi requires JZZ.js https://github.com/jazz-soft/JZZ

Try to include JZZ.js on your page, then call
if (!navigator.requestMIDIAccess) navigator.requestMIDIAccess = JZZ.requestMIDIAccess

@Pomax
Copy link
Author

Pomax commented May 21, 2022

Cheers. The new Firefox "you get midi but only after you submit yourself to our addon process so that we know which pages you've put on the web" is a super disappointing development, so I'd much rather just go "don't bother with FF itself, use Jazz" =P

@Pomax
Copy link
Author

Pomax commented May 21, 2022

Oh, is there an ES Module version of the library (with an export { JZZ } in it) so it can be loaded with the async attribute to not block the page, and imported the modern way without needing any old school "if not loaded setTimeout for 100ms and retry" shenanigans =)

@jazz-soft
Copy link
Owner

I'm afraid you have to do it manually. A CDN link would not take much loading time anyway.
Or, you are welcome to play around with the index.d.ts, however it would need some updates.

@Pomax
Copy link
Author

Pomax commented May 22, 2022

It does, but my entire codebase is ESM because IE11 is finally only a few weeks away from proper permanent death so ESM finally "just works(tm)" in everything (hurray!). Rather than playing around with index.d.ts, it might just be a matter of "use esbuild to build both versions".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants