I have a simple Electron application that I'm incorporating one HTML page that has a SWF object. I have included the Pepper Flash Player and replicated the main.js code from the tutorial. When I run the application from command prompt / git bash for testing, the SWF works fine. However, once I build the app and run it, the SWF content won't load. The content area simply displays "Couldn't load plugin.".
I've included both 32bit and 64bit versions of the Flash player plugin.
let pluginName;
switch (process.platform) {
case 'win32':
if (process.arch === 'x64' || process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')) {
console.log("64bit");
pluginName = "PEP/pepflashplayer64_29_0_0_171.dll";
}
else{
console.log("32bit");
pluginName = "PEP/pepflashplayer32_29_0_0_171.dll";
}
break
case 'darwin':
pluginName = 'PEP/PepperFlashPlayer.plugin'
break
}
app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, pluginName))
I figured out my issues (there were a few) through much trial and error.
In addition to this, in the app I updated the switch statement to determine whether it was a build or testing (from cmd line), as follows:
switch (process.platform) {
case 'win32':
if (basename === "resources") {
pluginName = "../../pepflashplayer32_29_0_0_171.dll";
}
else {
pluginName = "./plugins/pepflashplayer32_29_0_0_171.dll";
}
break
case 'darwin':
if (basename === "resources") {
pluginName = '../../PepperFlashPlayer.plugin'
}
else {
pluginName = './plugins/PepperFlashPlayer.plugin'
}
break
}
I hope this can save others a bit of time.