Electron supports the use of Pepper Flash plug-in. To use the Pepper Flash plugin in Electron, we need to manually set the path of Pepper Flash and enable Pepper Flash in our application.
Keep a copy of the Flash plug-in
On MacOS and Linux, you can find the Pepper Flash plugin in the Chrome browser’s Chrome ://plugins page. The path and version of the plug-in will help with Election support for it. You can also copy the plugin to another path to keep a copy.
Add plug-in switches in Electron
We can directly from the command line using – ppapi – flash – path and ppapi – flash – version or the app events before calling the app.com mandLine. AppendSwitch this method. Also add the browser-window plugin switch. Such as:
Const {app, BrowserWindow} = require('electron') const path = require('path') // Specify the flash path, assuming it is in the same directory as main.js. let pluginName switch (process.platform) { case 'win32': pluginName = 'pepflashplayer.dll' break case 'darwin': pluginName = 'PepperFlashPlayer.plugin' break case 'linux': pluginName = 'libpepflashplayer.so' break } app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, PluginName)) // Optional: Specify the version of Flash, For example v17.0.0.169 app.com mandLine. AppendSwitch (' ppapi - flash - version ', '17.0.0.169) app. On (' ready', () => { let win = new BrowserWindow({ width: 800, height: 600, webPreferences: { plugins: true } }) win.loadURL(`file://${__dirname}/index.html`) // ... })
Alternatively, you can try loading the Pepper Flash plugin installed on your system instead of shipping the plugin, whose path can be obtained by calling app.getPath(‘ PepperFlashSystemPlugin ‘).
Use the WebView TAB to enable the plug-in
Add the plugins property to the
tag. For example:
<webview src="http://www.adobe.com/software/flash/about/" plugins></webview>
troubleshooting
We can check if the Pepper Flash plugin is loaded by printing navigator.plugins in the console.
The Pepper Flash operating system must match the Electron operating system. In Windows, a common mistake is to use the 32-bit version of Flash plug-in for the 64-bit version of Electron.
In Windows, the path passed to –ppapi-flash-path must use ‘ ‘as the path delimiter. POSIX-style paths will not work.
For some operations, such as streaming media using RTMP, it is necessary to grant more permissions to the player’s.swf file. One way to do this is to use NW-Flash-Trust.
Link: https://www.9xkd.com/