系统运维

Electron 使用Pepper Flash插件

时间:2010-12-5 17:23:32  作者:人工智能   来源:人工智能  查看:  评论:0
内容摘要:Electron 中支持 Pepper Flash 插件的使用。想要在 Electron 里面使用 Pepper Flash 插件,我们需要手动设置 Pepper Flash 的路径,并且在应用程序中

Electron 中支持 Pepper Flash 插件的使用使用。想要在 Electron 里面使用 Pepper Flash 插件,使用我们需要手动设置 Pepper Flash 的使用路径,并且在应用程序中启用 Pepper Flash。使用

保留一份 Flash 插件的使用副本

在 macOS 和 Linux 上,我们可以在 Chrome 浏览器的使用 chrome://plugins 页面上找到 Pepper Flash 的插件信息。插件的使用路径和版本会对 Election 对其的支持有帮助。你也可以把插件复制到另一个路径以保留一份副本。使用

添加插件在 Electron 里的使用开关

我们可以直接在命令行中用 --ppapi-flash-path 和 ppapi-flash-version 或者在 app 的准备事件前调用

app.commandLine.appendSwitch 这个方法。同时添加 browser-window 的香港云服务器使用插件开关。例如:

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`)   // ... }) 

或者也可以尝试加载系统安装的 Pepper Flash 插件,而不是使用装运 插件,其路径可以通过调用 app.getPath(pepperFlashSystemPlugin) 获取。

使用webview标签启用插件

在<webview>标签里添加 plugins 属性。例如下面所示:

<webview src="http://www.adobe.com/software/flash/about/" plugins></webview>

故障排查

我们可以通过在控制台打印 navigator.plugins 来检查 Pepper Flash 插件是否加载 。

Pepper Flash 插件的操作系统必须和 Electron 的操作系统匹配。在 Windows 中, 一个常见的云服务器提供商错误是对 64 位版本的 Electron 使用 32bit 版本的 Flash 插件。

在 Windows 中,传递给 --ppapi-flash-path 的路径必须使用 `` 作为路径分隔符,使用 POSIX-style 的路径将无法工作。

对于一些操作,例如使用 RTMP 的流媒体,有必要向播放器的 .swf 文件授予更多的权限。 实现这一点的一种方式是使用 nw-flash-trust。源码库

copyright © 2025 powered by 益强资讯全景  滇ICP备2023006006号-31sitemap