方法一:复制chrome浏览器下的pepperflash,通过cef命令行参数设置路径。

public form1()
{
    initializecomponent();
    initializechromium();
}
 
private void initializechromium()
{
    chromiumwebbrowser.onbeforecfxinitialize += chromiumwebbrowser_onbeforecfxinitialize;
    chromiumwebbrowser.onbeforecommandlineprocessing += chromiumwebbrowser_onbeforecommandlineprocessing;
    chromiumwebbrowser.initialize();
 
    chromiumwebbrowser wb = new chromiumwebbrowser();
    wb.dock = dockstyle.fill;
    wb.parent = this;
    wb.loadurl("chrome://version");
}
 
void chromiumwebbrowser_onbeforecommandlineprocessing(chromium.event.cfxonbeforecommandlineprocessingeventargs e)
{
    e.commandline.appendswitch("--disable-web-security");//关闭同源策略
    e.commandline.appendswitchwithvalue("ppapi-flash-version", "18.0.0.209");//pepperflash\manifest.json中的version
    e.commandline.appendswitchwithvalue("ppapi-flash-path", "pepperflash\\pepflashplayer.dll");
}
 
void chromiumwebbrowser_onbeforecfxinitialize(chromium.webbrowser.event.onbeforecfxinitializeeventargs e)
{
    e.settings.cachepath = "session";
    e.settings.locale = "zh-cn";
}

方法二:通过命令行参数设置cef使用系统安装的flash

void chromiumwebbrowser_onbeforecommandlineprocessing(chromium.event.cfxonbeforecommandlineprocessingeventargs e)
{
    e.commandline.appendswitch("--disable-web-security");//关闭同源策略
    e.commandline.appendswitch("--enable-system-flash");//使用系统flash
}

 

chromium has removed support for npapi and consequently cef no longer supports loading of the npapi flash plugin. to support loading of the pepper (ppapi) flash plugin the following implementation must be brought over from chrome:

in the browser process:

  1. chromecontentclient::addpepperplugins — locates the flash plugin library. in cef this will be implemented via cefcontentclient::addpepperplugins.
  2. chromecontentbrowserclientpluginspart::didcreateppapiplugin — creates the chromebrowserpepperhostfactory that is responsible for the browser side of ppapi message routing. in cef this will be implemented via cefcontentbrowserclient::didcreateppapiplugin.
  3. chromebrowserpepperhostfactory::createresourcehost — creates the hosts for individual pieces of flash-related functionality (e.g. pepperflashbrowserhost, pepperflashclipboardmessagefilter, pepperflashdrmhost).

in the renderer process:

  1. chromecontentrendererclient::renderframecreated — creates the chromerendererpepperhostfactory (via the per-renderframe pepperhelper) that is responsible for the renderer side of ppapi message routing. in cef this will be implemented via cefcontentrendererclient::renderframecreated.
  2. chromerendererpepperhostfactory::createresourcehost — creates the hosts for individual pieces of flash-related functionality (e.g. pepperflashrendererhost, pepperflashfullscreenhost, pepperflashmenuhost, pepperflashfontfilehost, pepperflashdrmrendererhost).

参考: