Learning about CefSharp. WinForms, cefsharp. winforms
Some time ago, I used CefSharp. WinForms to write a program that can play flash and display pages, involving cross-origin access and other issues. CefSharp. WinForms version 49.0.1.
At the beginning, it was quite smooth, so that all kinds of black screens could not be played during flash playback. First, the version 32 was solved by using the NPAPI, but it seems that the version 32 had various dead programs after various 10 minutes on the client, and there was no way to find a solution.
Finally, set to read pepflashplayer. dll to play falsh. below is my configuration code for this version.
// Open the static address string strMenu = System. windows. forms. application. startupPath; // pepflashplayerDLL address string flashPath = strMenu + "\ plugins \ pepflashplayer32_21_0_0_182.dll"; CefSettings set = new CefSettings (); set. cachePath = "cache"; // enable ppapi-flash set. cefCommandLineArgs ["enable-system-flash"] = "1"; set. cefCommandLineArgs. add ("ppapi-flash-version", "21.0.0.182"); // Insert the address set. cefCommandLineArgs. add ("ppapi-flash-path", flashPath); // enable CefSharp. cef. initialize (set );
Finally, paste a complete Running code
Public FromIndex () {InitializeComponent (); InitBrowser ();} public void InitBrowser () {// open the static address string strMenu = System. windows. forms. application. startupPath; // pepflashplayerDLL address string flashPath = strMenu + "\ plugins \ pepflashplayer32_21_0_0_182.dll"; CefSettings set = new CefSettings (); set. cachePath = "cache"; // enable ppapi-flash set. cefCommandLineArgs ["enable-system-flash"] = "1"; set. cefCommandLineArgs. add ("ppapi-flash-version", "21.0.0.182"); // Insert the address set. cefCommandLineArgs. add ("ppapi-flash-path", flashPath); // enable CefSharp. cef. initialize (set); var htmlDidr = "\ Files \ LargeScreen \ index.htm"; ChromiumWebBrowser browser = new ChromiumWebBrowser (""); BrowserSettings bset = new BrowserSettings (); bset. plugins = CefState. enabled; // cross-origin restriction bset. webSecurity = CefState. disabled; browser. browserSettings = bset; // open the browser page. load (strMenu + htmlDidr); // bind the JS browser. registerJsObject ("callbackObj", new CallbackObjectForJs (); this. controls. add (browser); browser. dock = DockStyle. fill; browser. update ();}