Function init

Source
pub fn init<R: Runtime>() -> TauriPlugin<R>
Expand description

Initialise the plugin which will take care of polyfilling WebMIDI into any Tauri webview.

§Usage

Using this plugin is very simple. Just add it to your Tauri builder:

 tauri::Builder::default()
       .plugin(tauri_plugin_midi::init()) // <- This bit here
       // .... rest of your builder

Then give permissions to the plugin by adding the midi:default permissions to your application.

This can be done by modifying the capabilities/default.json file:

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": ["main"],
  "permissions": ["core:default", "midi:default"] // <- add `midi:default` into here
}

and now you can use the regular WebMIDI API from within your webview.

§Known issues

  • This plugin doesn’t work within iframes at the moment. It’s being tracked as #7