Learning about CefSharp. WinForms, cefsharp. winforms

Source: Internet
Author: User

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 ();}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.