如何使flash在我的电子应用程序中工作?

如何使flash在我的电子应用程序中工作?,flash,electron,Flash,Electron,我正在尝试为flash游戏创建一个启动器。我在电子和编程方面是新手,所以我正在阅读电子文档,但我的flash不工作 const electron = require('electron') const { app, BrowserWindow } = require('electron') const path = require('path'); let pluginName switch (process.platform) { case 'win32': pluginName =

我正在尝试为flash游戏创建一个启动器。我在电子和编程方面是新手,所以我正在阅读电子文档,但我的flash不工作

const electron = require('electron')
const { app, BrowserWindow } = require('electron')
const path = require('path');
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))
function createWindow () {
 // Create the browser window.
 let win = new BrowserWindow({
   width: 800,
   height: 600,
   webPreferences: {
     nodeIntegration: true,
     plugins: true,
     webviewTag: true
   }
 }) 
 win.removeMenu(BrowserWindow);

 // and load the index.html of the app.
 win.loadFile('index.html')

 win.on('closed', () => {
   // Dereference the window object, usually you would store windows
   // in an array if your app supports multi windows, this is the time
   // when you should delete the corresponding element.
   win = null
 })

}

app.on('ready', createWindow)

app.on('window-all-closed', () => {
 // On macOS it is common for applications and their menu bar
 // to stay active until the user quits explicitly with Cmd + Q
 if (process.platform !== 'darwin') {
   app.quit()
 }
})

app.on('activate', () => {
 // On macOS it's common to re-create a window in the app when the
 // dock icon is clicked and there are no other windows open.
 if (win === null) {
   createWindow()
 }
})
站点加载正常,但闪存不工作。那么,是不是我做错了什么?我怎样才能让它工作

谢谢

Obs:这是我代表OP发布的main.js

使用较旧的electron版本(4.2.6)。较新的electron版本(高于4.2.6)将不会加载flash内容


编辑:在Linux中,4.2.x系列的最新electron将与flash player配合使用。在windows中,最新版本正常工作

Flash似乎至少在某种程度上与Electron 9.0配合工作。我有一个测试应用程序,其中Electron 9(Chromium 83)将插件加载到我的Mac电脑上,并在这里看到:目前在保存嵌入Electron应用程序的Flash应用程序想要保存的文件时遇到了一些问题,但这可能一直是Flash Player Electron集成的一个问题?不确定。

看看这是否有帮助:lib flash在同一个目录中。可能这个问题与chromium默认块链接到flash?我不使用Electron
pluginName='./pepflashplayer.dll'
你是说这样做是行不通的吗?另外,您认为Electron会接受替代的NP-API文件
NPSWF32.dll
,而不是Chromium自己使用PP-API的版本吗?安装Flash Player程序后,找到DLL并将其复制到应用程序目录中。如果要使用Flash,请使用electron 4.2.6,但不得高于4.2.11:(在windows中,last electron可以使用flashI创建社区wiki,因此如果您想在自己的答案中添加内容,可以对其进行编辑。@aquasp或者,如果您想将其作为自己的答案发布,可以这样做并ping我,以便我删除此社区wiki。没问题:)我认为作为社区答案也可以