You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to build a electron app which support flash. So I use an old electron 4.2.12. And write the main code like the following.
'use strict'const{ app, BrowserWindow }=require('electron')constpath=require('path')constfs=require('fs')constisDevelopment=process.env.NODE_ENV!=='production'console.info(isDevelopment)// global reference to mainWindow (necessary to prevent window from being garbage collected)letmainWindowfunctioncreateMainWindow(){console.info(`createMainWindow`)constwindow=newBrowserWindow({webPreferences: {nodeIntegration: true,contextIsolation: false,enableRemoteModule: false,plugins: true,}})if(isDevelopment){window.webContents.openDevTools()}window.loadURL('https://www.ultrasounds.com/');window.on('closed',()=>{mainWindow=null})window.webContents.on('devtools-opened',()=>{window.focus()setImmediate(()=>{window.focus()})})returnwindow}// Specify flash path, supposing it is placed in the same directory with main.js.constflash_version='27_0_0_159';constarch=process.arch==='x64' ? '64' : '32';letpluginName;switch(process.platform){case'win32':
pluginName=`pepflashplayer${arch}_${flash_version}.dll`breakcase'darwin':
pluginName=`PepperFlashPlayer${arch}_${flash_version}.plugin`breakcase'linux':
pluginName=`libpepflashplayer${arch}_${flash_version}.so`break}constflash_path=path.join(__dirname,'pepper_flash',pluginName);console.info(`try to use flash_version: ${flash_version}, flash_path: ${flash_path}`);if(!fs.existsSync(flash_path)){console.error(`flash_path ${flash_path} does not exists!`);}else{console.info(`flash_path ${flash_path} ok!`);}app.commandLine.appendSwitch('ppapi-flash-path',flash_path)// Optional: Specify flash versionapp.commandLine.appendSwitch('ppapi-flash-version',flash_version)// app.commandLine.appendSwitch('--enable-sandbox')// quit application when all windows are closedapp.on('window-all-closed',()=>{// on macOS it is common for applications to stay open until the user explicitly quitsif(process.platform!=='darwin'){app.quit()}})app.on('activate',()=>{// on macOS it is common to re-create a window even after all windows have been closedif(mainWindow===null){mainWindow=createMainWindow()}})// create main BrowserWindow when electron is readyapp.on('ready',()=>{mainWindow=createMainWindow()})
The strange thing is when I run yarn electron src/main.js or yarn compile && yarn electron dist/main/main.js. The console always showed NOT SANDBOXED (electron/electron#1779) and the flash plugin loaded successfully.
However, when I run yarn dev, the console did not show NOT SANDBOXED, and the webpage showed Couldn't load plugin.
Windows
I want to build a electron app which support flash. So I use an old electron
4.2.12
. And write the main code like the following.The strange thing is when I run
yarn electron src/main.js
oryarn compile && yarn electron dist/main/main.js
. The console always showedNOT SANDBOXED
(electron/electron#1779) and the flash plugin loaded successfully.However, when I run
yarn dev
, the console did not showNOT SANDBOXED
, and the webpage showedCouldn't load plugin.
pepper_flash.zip
The text was updated successfully, but these errors were encountered: