2015-05-19 12:27:12 +00:00
|
|
|
# Using Pepper Flash Plugin
|
|
|
|
|
2016-04-26 01:24:43 +00:00
|
|
|
Electron supports the Pepper Flash plugin. To use the Pepper Flash plugin in
|
2015-09-01 02:23:43 +00:00
|
|
|
Electron, you should manually specify the location of the Pepper Flash plugin
|
|
|
|
and then enable it in your application.
|
2015-05-19 12:27:12 +00:00
|
|
|
|
2015-09-01 02:23:43 +00:00
|
|
|
## Prepare a Copy of Flash Plugin
|
2015-05-19 12:27:12 +00:00
|
|
|
|
2015-09-01 02:23:43 +00:00
|
|
|
On OS X and Linux, the details of the Pepper Flash plugin can be found by
|
|
|
|
navigating to `chrome://plugins` in the Chrome browser. Its location and version
|
|
|
|
are useful for Electron's Pepper Flash support. You can also copy it to another
|
|
|
|
location.
|
2015-05-19 12:27:12 +00:00
|
|
|
|
2015-09-01 02:23:43 +00:00
|
|
|
## Add Electron Switch
|
2015-05-19 12:27:12 +00:00
|
|
|
|
2015-09-01 02:23:43 +00:00
|
|
|
You can directly add `--ppapi-flash-path` and `ppapi-flash-version` to the
|
|
|
|
Electron command line or by using the `app.commandLine.appendSwitch` method
|
2016-04-26 01:24:43 +00:00
|
|
|
before the app ready event. Also, turn on `plugins` option of `BrowserWindow`.
|
2015-09-01 02:23:43 +00:00
|
|
|
For example:
|
2015-05-19 12:27:12 +00:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
// Specify flash path.
|
2016-04-25 13:45:56 +00:00
|
|
|
// On Windows, it might be /path/to/pepflashplayer.dll or just pepflashplayer.dll if it resides main.js
|
2015-10-31 02:30:18 +00:00
|
|
|
// On OS X, /path/to/PepperFlashPlayer.plugin
|
2015-05-19 12:27:12 +00:00
|
|
|
// On Linux, /path/to/libpepflashplayer.so
|
|
|
|
app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so');
|
|
|
|
|
2016-04-25 13:45:56 +00:00
|
|
|
// Optional: Specify flash version, for example, v17.0.0.169
|
2015-05-19 12:27:12 +00:00
|
|
|
app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169');
|
|
|
|
|
2016-05-04 18:11:51 +00:00
|
|
|
app.on('ready', () => {
|
2016-05-10 17:38:42 +00:00
|
|
|
win = new BrowserWindow({
|
2016-04-26 01:24:43 +00:00
|
|
|
width: 800,
|
|
|
|
height: 600,
|
|
|
|
webPreferences: {
|
|
|
|
plugins: true
|
2015-05-20 10:04:51 +00:00
|
|
|
}
|
2015-05-19 12:27:12 +00:00
|
|
|
});
|
2016-05-10 17:38:42 +00:00
|
|
|
win.loadURL(`file://${__dirname}/index.html`);
|
2015-05-19 12:27:12 +00:00
|
|
|
// Something else
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2016-06-08 20:37:27 +00:00
|
|
|
The path to the system wide Pepper Flash plugin can also be obtained by calling `app.getPath('pepperFlashSystemPlugin')`.
|
|
|
|
|
2015-09-01 02:23:43 +00:00
|
|
|
## Enable Flash Plugin in a `<webview>` Tag
|
|
|
|
|
2015-05-19 12:27:12 +00:00
|
|
|
Add `plugins` attribute to `<webview>` tag.
|
2015-09-01 02:23:43 +00:00
|
|
|
|
2015-05-19 12:27:12 +00:00
|
|
|
```html
|
|
|
|
<webview src="http://www.adobe.com/software/flash/about/" plugins></webview>
|
|
|
|
```
|
2016-04-26 01:24:43 +00:00
|
|
|
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
You can check if Pepper Flash plugin was loaded by inspecting
|
|
|
|
`navigator.plugins` in the console of devtools (although you can't know if the
|
|
|
|
plugin's path is correct).
|
|
|
|
|
|
|
|
The architecture of Pepper Flash plugin has to match Electron's one. On Windows,
|
|
|
|
a common error is to use 32bit version of Flash plugin against 64bit version of
|
|
|
|
Electron.
|