Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Electron uses the Pepper Flash plug-in


May 25, 2021 Electron


Table of contents


Electron now supports the Pepper Flash plug-in. To use the Pepper Flash plug-in in Electron, you need to manually set the path to Pepper Flash and enable Pepper Flash in your app.

Keep a copy of the Flash plug-in

On OS X and Linux, you can find PepperFlash chrome://plugins Chrome's web page. T he path and version of the plug-in can be helpful for Election's support. You can also copy the plug-in to another path to keep a copy.

Add the switch of the plug-in in Electron

You can use --ppapi-flash-path and ppapi-flash-version directly on the command line, or call app.commandLine.appendSwitch before the app prepares for the event. A t the same time, browser-window switch for browser-window. For example:

// Specify flash path. 设置 flash 路径
// On Windows, it might be /path/to/pepflashplayer.dll
// On OS X, /path/to/PepperFlashPlayer.plugin
// On Linux, /path/to/libpepflashplayer.so
app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so');

// Specify flash version, for example, v17.0.0.169 设置版本号
app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169');

app.on('ready', function() {
  mainWindow = new BrowserWindow({
    'width': 800,
    'height': 600,
    'web-preferences': {
      'plugins': true
    }
  });
  mainWindow.loadURL('file://' + __dirname + '/index.html');
  // Something else
});

Enable <webview> hashtags

Add the plugins <webview> to the hashtag.

<webview src="http://www.adobe.com/software/flash/about/" plugins></webview>