cefsharp加入flash插件

读取pepflashplayer.dll播放falsh

pepflashplayer.dll文件下载 (包含64位和32位) :https://download.csdn.net/download/qq_20757489/10908786

代码部分:

//打开静态地址
            string strMenu = System.Windows.Forms.Application.StartupPath;
            //pepflashplayerDLL 地址
            string flashPath = strMenu + "\\plugins\\pepflashplayer32_21_0_0_182.dll";
            CefSettings set = new CefSettings();
            set.CachePath = "cache";
            //开启ppapi-flash
            set.CefCommandLineArgs["enable-system-flash"] = "1";
            set.CefCommandLineArgs.Add("ppapi-flash-version", "21.0.0.182");
            //插入地址
            set.CefCommandLineArgs.Add("ppapi-flash-path", flashPath);
            //启用配置
            CefSharp.Cef.Initialize(set);
public FromIndex()
        {
            InitializeComponent();
            InitBrowser();
        }

        public void InitBrowser()
        {
            //打开静态地址
            string strMenu = System.Windows.Forms.Application.StartupPath;
            //pepflashplayerDLL 地址
            string flashPath = strMenu + "\\plugins\\pepflashplayer32_21_0_0_182.dll";
            CefSettings set = new CefSettings();
            set.CachePath = "cache";
            //开启ppapi-flash
            set.CefCommandLineArgs["enable-system-flash"] = "1";
            set.CefCommandLineArgs.Add("ppapi-flash-version", "21.0.0.182");
            //插入地址
            set.CefCommandLineArgs.Add("ppapi-flash-path", flashPath);
            //启用配置
            CefSharp.Cef.Initialize(set);

           
            var htmlDidr = "\\Files\\LargeScreen\\index.htm";
            ChromiumWebBrowser browser = new ChromiumWebBrowser("");
            BrowserSettings bset = new BrowserSettings();
            bset.Plugins = CefState.Enabled;
            //关于跨域限制
            bset.WebSecurity = CefState.Disabled;
            browser.BrowserSettings = bset;
            //打开网页
            browser.Load(strMenu + htmlDidr);
            //绑定JS
            browser.RegisterJsObject("callbackObj", new CallbackObjectForJs());
            this.Controls.Add(browser);
            browser.Dock = DockStyle.Fill;
            browser.Update();
        }

如果需要支持流媒体m3u8,对于cefsharp要开启跨域限制,代码上面有!

猜你喜欢

转载自blog.csdn.net/qq_20757489/article/details/86232122