打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
[原创]Cef3 2623.1397 开启ppapi flash插件 SOUI

最近发现WKE播放Flash或者游戏时会有很多BUG,例如视频无法播放或者是Stage3D无法使用等问题。

经过研究应该是精简版本导致的,所以决定尝试使用CEF3移植入SOUI,但是DEMO中版本有点旧,所以想升级。

发现23XX版本开始 无法直接使用npapi的flash插件,默认是关闭的

这里以CEF的DEMO程序CEFCLIENT为例子:

有2种方式可以启动FLASH插件,但是我不推荐NPAPI方式,实际上非常不好,据说是效率低下以及不稳定。

所以这里默认为PPAPI的方式。

(这里说的是FLASH插件的NPAPI版本卡,不是说NPAPI卡,我措辞不严谨,和PPAPI和NPAPI本身技术无关,仅仅针对FLASH插件,不信的自己可以试试)

 

首先要做的:

在CEFCLIENT目录下新建目录 PepperFlash 把下载好的 pepflashplayer.dll 插件丢入该目录即可。

然后跟着以下方法做。

方法1:

直接给编译好的CEFCLIENT创建一个快捷方式 快捷方式后加入参数 --register-pepper-plugins="PepperFlash/pepflashplayer.dll;application/x-shockwave-flash" 然后使用快捷方式启动即可发现FLASH正常播放。

如果希望开启NPAPI方式,再加入参数 --enable-npapi 即可。

 

方法2:

不像以上方法,需要快捷方式等,可以无参数启动。

打开源码 CEFCLIENT,并且打开文件 client_app_browser.cc 文件,找到函数 OnBeforeCommandLineProcessing。

 1 void ClientAppBrowser::OnBeforeCommandLineProcessing( 2     const CefString& process_type, 3     CefRefPtr<CefCommandLine> command_line) { 4   // Pass additional command-line flags to the browser process. 5   if (process_type.empty()) { 6     // Pass additional command-line flags when off-screen rendering is enabled. 7     if (command_line->HasSwitch(switches::kOffScreenRenderingEnabled)) { 8       // If the PDF extension is enabled then cc Surfaces must be disabled for 9       // PDFs to render correctly.10       // See https://bitbucket.org/chromiumembedded/cef/issues/1689 for details.11       if (!command_line->HasSwitch("disable-extensions") &&12           !command_line->HasSwitch("disable-pdf-extension")) {13         command_line->AppendSwitch("disable-surfaces");14       }15 16       // Use software rendering and compositing (disable GPU) for increased FPS17       // and decreased CPU usage. This will also disable WebGL so remove these18       // switches if you need that capability.19       // See https://bitbucket.org/chromiumembedded/cef/issues/1257 for details.20       if (!command_line->HasSwitch(switches::kEnableGPU)) {21         command_line->AppendSwitch("disable-gpu");22         command_line->AppendSwitch("disable-gpu-compositing");23       }24 25       // Synchronize the frame rate between all processes. This results in26       // decreased CPU usage by avoiding the generation of extra frames that27       // would otherwise be discarded. The frame rate can be set at browser28       // creation time via CefBrowserSettings.windowless_frame_rate or changed29       // dynamically using CefBrowserHost::SetWindowlessFrameRate. In cefclient30       // it can be set via the command-line using `--off-screen-frame-rate=XX`.31       // See https://bitbucket.org/chromiumembedded/cef/issues/1368 for details.32       command_line->AppendSwitch("enable-begin-frame-scheduling");33     }34 35     // 此参数解决多窗口问题36     command_line->AppendSwitch("process-per-site");37     command_line->AppendSwitch("enable-npapi");38     command_line->AppendSwitchWithValue("register-pepper-plugins", "PepperFlash/pepflashplayer.dll;application/x-shockwave-flash");39 40     DelegateSet::iterator it = delegates_.begin();41     for (; it != delegates_.end(); ++it)42       (*it)->OnBeforeCommandLineProcessing(this, command_line);43   }44 }

修改代码如上,重新编译即可。

再打开YOUKU看看,是不是OK了。

还有发现右键菜单都是英文,这里可以在SETTINGS中设置参数locale为zh-CN即可。

1   std::string locale("zh-CN");2   cef_string_utf8_to_utf16(locale.c_str(), locale.size(), &settings.locale);

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
cef3 cefglue注册npapi插件ActiveX插件
浏览器卡顿反应慢,shockwave flash插件没有响应
解决浏览器Shockwave flash 未响应的问题
Adobe Flash Player for Firefox下载 v18.0.0.95
Delphi中Chrome Chromium、Cef3学习笔记(六)
谷歌浏览器禁止Flash?少年,你不是当真了吧?| 专栏
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服