2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# Using Pepper Flash Plugin
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-26 10:24:43 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Electron supports the Pepper Flash plugin. To use the Pepper Flash plugin in
							 
						 
					
						
							
								
									
										
										
										
											2015-08-31 19:23:43 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Electron, you should manually specify the location of the Pepper Flash plugin
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								and then enable it in your application.
							 
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-31 19:23:43 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Prepare a Copy of Flash Plugin
  
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 15:26:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								On macOS and Linux, the details of the Pepper Flash plugin can be found by
							 
						 
					
						
							
								
									
										
										
										
											2018-07-13 22:10:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								navigating to `chrome://flash`  in the Chrome browser. Its location and version
							 
						 
					
						
							
								
									
										
										
										
											2015-08-31 19:23:43 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								are useful for Electron's Pepper Flash support. You can also copy it to another
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								location.
							 
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-31 19:23:43 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Add Electron Switch
  
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-15 09:41:47 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								You can directly add `--ppapi-flash-path`  and `--ppapi-flash-version`  to the
							 
						 
					
						
							
								
									
										
										
										
											2015-08-31 19:23:43 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Electron command line or by using the `app.commandLine.appendSwitch`  method
							 
						 
					
						
							
								
									
										
										
										
											2016-04-26 10:24:43 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								before the app ready event. Also, turn on `plugins`  option of `BrowserWindow` .
							 
						 
					
						
							
								
									
										
										
										
											2016-06-15 09:41:47 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-31 19:23:43 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								For example:
							 
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```javascript
							 
						 
					
						
							
								
									
										
										
										
											2018-09-14 02:10:51 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								const { app, BrowserWindow } = require('electron')
							 
						 
					
						
							
								
									
										
										
										
											2016-07-25 18:39:25 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								const path = require('path')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-15 09:41:47 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// Specify flash path, supposing it is placed in the same directory with 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))
							 
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-25 16:45:56 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// Optional: Specify flash version, for example, v17.0.0.169
							 
						 
					
						
							
								
									
										
										
										
											2016-06-15 09:41:47 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169')
							 
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 16:43:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								app.whenReady().then(() => {
							 
						 
					
						
							
								
									
										
										
										
											2016-07-25 18:39:25 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  let win = new BrowserWindow({
							 
						 
					
						
							
								
									
										
										
										
											2016-04-26 10:24:43 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    width: 800,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    height: 600,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    webPreferences: {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      plugins: true
							 
						 
					
						
							
								
									
										
										
										
											2015-05-20 18:04:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2016-06-15 09:41:47 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  })
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  win.loadURL(`file://${__dirname}/index.html` )
							 
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  // Something else
							 
						 
					
						
							
								
									
										
										
										
											2016-07-25 18:39:25 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								})
							 
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-15 09:41:47 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								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')` . 
						 
					
						
							
								
									
										
										
										
											2016-06-08 16:37:27 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-31 19:23:43 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Enable Flash Plugin in a `<webview>` Tag
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Add `plugins`  attribute to `<webview>`  tag.
							 
						 
					
						
							
								
									
										
										
										
											2015-08-31 19:23:43 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```html
							 
						 
					
						
							
								
									
										
										
										
											2018-01-12 12:24:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								< webview  src = "https://www.adobe.com/software/flash/about/"  plugins > < / webview >  
						 
					
						
							
								
									
										
										
										
											2015-05-19 20:27:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2016-04-26 10:24:43 +09: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.
							 
						 
					
						
							
								
									
										
										
										
											2016-06-15 09:41:47 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								On Windows the path passed to `--ppapi-flash-path`  has to use `\`  as path
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								delimiter, using POSIX-style paths will not work.
							 
						 
					
						
							
								
									
										
										
										
											2016-10-14 12:51:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								For some operations, such as streaming media using RTMP, it is necessary to grant wider permissions to players’ `.swf`  files. One way of accomplishing this, is to use [nw-flash-trust ](https://github.com/szwacz/nw-flash-trust ).