使用 Pepper Flash 插件
准备Flash插件的副本
在 Electron 中 添加支持
const {app, BrowserWindow} = require('electron')
const path = require('path')
// 指定flash路径, 假设与main.js同一目录.
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))
// 可选:指定Flash版本,比如v17.0.0.169
app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169')
app.on('ready', () => {
let win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
plugins: true
}
})
win.loadURL(`file://${__dirname}/index.html`)
// 其它
})在 <webview>标签中启用Flash插件
<webview>标签中启用Flash插件故障排除
Last updated