CEF 加载flash 插件

来源:互联网 发布:业务网站源码 编辑:程序博客网 时间:2024/05/17 09:44

http://blog.csdn.net/x356982611/article/details/52291122


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

  • 重载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:};
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

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");}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

参考地址: 
https://bitbucket.org/chromiumembedded/cef/issues/1586/add-pepper-flash-plugin-support

这里写图片描述