Reputation: 77
I am trying to create a launcher for a flash game. I am new in electron and in programming so I was reading the electron documentation but my flash isn't working.
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()
}
})
The site loads normally but the flash isn't working. So, is something that I am doing wrong? How can I get it working?
Thanks!
Obs: This is my main.js
Upvotes: 3
Views: 3994
Reputation: 33324
Use an older electron version (4.2.6). Newer electron versions (newer than 4.2.6) will not load flash content.
Edit: In Linux, latest electron from 4.2.x series will work with flash player. In windows, latest version works normally
Added on behalf of question asker.
Upvotes: 1
Reputation: 151
Flash appears to be working at least to some extent with Electron 9.0. I've got a test app with Electron 9 (Chromium 83) loading the plugin on my Mac, and also see here: Can I bundle Pepper Flash in an Electron.js app to run Flash in 2021+? Presently having some trouble saving files that my Flash app wants to save while it is embedded within my Electron app, but that may have always been an issue with Flash Player-Electron integration? Not sure.
Upvotes: 0