我正在尝试为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()
}
})
网站正常加载,但闪光灯不起作用。所以,我做错了什么吗?我该如何运作?
谢谢!
糟糕:这是我的main.js
答案 0 :(得分:1)
代表OP发布
使用较旧的电子版本(4.2.6)。较新的电子版本(高于4.2.6)将不会加载Flash内容。
答案 1 :(得分:0)
Flash至少在某种程度上可以与Electron 9.0一起使用。我有一个带有Electron 9(Chromium 83)的测试应用程序,正在我的Mac上加载插件,并且还可以在这里看到:Can I bundle Pepper Flash in an Electron.js app to run Flash in 2021+?当前在保存Flash应用程序要保存在我的Flash应用程序中要保存的文件时遇到了一些麻烦电子应用程序,但这可能一直是Flash Player与电子设备集成的问题?不确定。