首先 按需要下载32位或者64位的 pepflashplayer.dll
将pepflashplayer.dll放到项目中
然后在main.js中注册
// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron')
const path = require('path')
let pluginName;
switch (process.platform) {
case 'win32':
pluginName = 'pepflashplayer64_32_0_0_270.dll'
break
case 'darwin':
pluginName = 'PepperFlashPlayer.plugin'
break
case 'linux':
pluginName = 'libpepflashplayer.so'
break
}
let plugins = path.join( __dirname, pluginName);
if (__dirname.includes(".asar")) {
plugins = path.join(process.resourcesPath + '/' + pluginName)
}
app.commandLine.appendSwitch('ppapi-flash-path', plugins)
function createWindow() {
// let img = nativeImage.createFromPath( '512.jpg')
// Create the browser window.
mainWindow = new BrowserWindow({
// fullscreen: true,
autoHideMenuBar: true,
webPreferences: {
nodeIntegra

这篇博客介绍了如何在 Electron 项目中使用 Pepper Flash Player(pepflashplayer.dll)。首先,需要根据系统下载对应的 dll 文件并将其放入项目中。接着,在 main.js 中进行注册,确保在打包时通过 'extraResources' 配置项包含 dll 文件,以保证其出现在打包后的 resources 目录下。如果不进行配置,可以手动复制文件到正确位置。
最低0.47元/天 解锁文章
4426





