Improve the docs on loading flash plugin
This commit is contained in:
parent
9223019af8
commit
be90e2e9ff
1 changed files with 25 additions and 10 deletions
|
@ -13,20 +13,30 @@ location.
|
||||||
|
|
||||||
## Add Electron Switch
|
## Add Electron Switch
|
||||||
|
|
||||||
You can directly add `--ppapi-flash-path` and `ppapi-flash-version` to the
|
You can directly add `--ppapi-flash-path` and `--ppapi-flash-version` to the
|
||||||
Electron command line or by using the `app.commandLine.appendSwitch` method
|
Electron command line or by using the `app.commandLine.appendSwitch` method
|
||||||
before the app ready event. Also, turn on `plugins` option of `BrowserWindow`.
|
before the app ready event. Also, turn on `plugins` option of `BrowserWindow`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// Specify flash path.
|
// Specify flash path, supposing it is placed in the same directory with main.js.
|
||||||
// On Windows, it might be /path/to/pepflashplayer.dll or just pepflashplayer.dll if it resides main.js
|
let pluginName
|
||||||
// On OS X, /path/to/PepperFlashPlayer.plugin
|
switch (process.platform) {
|
||||||
// On Linux, /path/to/libpepflashplayer.so
|
case 'win32':
|
||||||
app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so');
|
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 flash version, for example, v17.0.0.169
|
// Optional: Specify flash version, for example, v17.0.0.169
|
||||||
app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169');
|
app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169')
|
||||||
|
|
||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
win = new BrowserWindow({
|
win = new BrowserWindow({
|
||||||
|
@ -35,13 +45,15 @@ app.on('ready', () => {
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
plugins: true
|
plugins: true
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
win.loadURL(`file://${__dirname}/index.html`);
|
win.loadURL(`file://${__dirname}/index.html`)
|
||||||
// Something else
|
// Something else
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
The path to the system wide Pepper Flash plugin can also be obtained by calling `app.getPath('pepperFlashSystemPlugin')`.
|
You can also try loading the system wide Pepper Flash plugin instead of shipping
|
||||||
|
the plugins yourself, its path can be received by calling
|
||||||
|
`app.getPath('pepperFlashSystemPlugin')`.
|
||||||
|
|
||||||
## Enable Flash Plugin in a `<webview>` Tag
|
## Enable Flash Plugin in a `<webview>` Tag
|
||||||
|
|
||||||
|
@ -60,3 +72,6 @@ plugin's path is correct).
|
||||||
The architecture of Pepper Flash plugin has to match Electron's one. On Windows,
|
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
|
a common error is to use 32bit version of Flash plugin against 64bit version of
|
||||||
Electron.
|
Electron.
|
||||||
|
|
||||||
|
On Windows the path passed to `--ppapi-flash-path` has to use `\` as path
|
||||||
|
delimiter, using POSIX-style paths will not work.
|
||||||
|
|
Loading…
Reference in a new issue