Loading NPAPI Plugin


#1

Hey everyone,

I have an NPAPI module that i’m creating to use in electron. I need to have keyup/keydown events for my keybinds for my application (voice chat application for gamers) and need to use lower level OS APIs for this.

From what I can tell, the two approaches for this are to use PPAPI or NPAPI plugins for this. I created a quick NPAPI plugin using firebreath and can confirm that it loads in chrome/firefox when using ‘regsvr32 npBarkKeys.dll’ on my console to load the plugin.

I’m trying to figure out a way to distribute this dll in electron using plugins, and cannot get the plugin to load in electron.
I’m trying to load directly in the browser window using the web prefences extra-plugindir, but i’m having no success.

app.commandLine.appendSwitch('enable-npapi');

app.on('ready', function() {
  // Create the browser window.
  mainWindow = new BrowserWindow({
    width: 1600,
    height: 900,
    'web-preferences': {
      plugins: true,
      'extra-plugin-dirs': [__dirname + '/plugins/', __dirname + '/plugins/npBarkKeys.dll']
    }
  });

Has anyone been able to successfully load an npapi plugin in electron?


#2

Isn’t NPAPI support already deprecated on Chrome, and will soon be removed entirely?


#3

It is deprecated at the moment, but from what I can tell PPAPI support for plugins is not in electron yet (only for flash), so i’m left with only NPAPI to create this plugin.