CEF可以通过命令行设置加载flash插件,有两种方式:
- 在程序启动时添加命令行参数
cef.exe --ppapi-flash-path=ppflash/18_0_0_209/pepflashplayer32_18_0_0_209.dll --ppapi-flash-version=18.0.0.209
override
OnBeforeCommandLineProcessing函数
class CCefClientApp : public CefApp, public CefBrowserProcessHandler
{
public:
CCefClientApp();
~CCefClientApp();
// CefApp methods:
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override
{
return this;
}
virtual void OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line) override;
// CefBrowserProcessHandler methods:
virtual void OnContextInitialized() override;
private:
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(CCefClientApp);
private:
};
void CCefClientApp::OnBeforeCommandLineProcessing(const CefString & process_type, CefRefPtr<CefCommandLine> command_line)
{
//加载flash插件
command_line->AppendSwitchWithValue("--ppapi-flash-path", "ppflash/18_0_0_209/pepflashplayer32_18_0_0_209.dll");
//manifest.json中的version
command_line->AppendSwitchWithValue("--ppapi-flash-version", "18.0.0.209");
}
参考地址:
https://bitbucket.org/chromiumembedded/cef/issues/1586/add-pepper-flash-plugin-support