Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Windows 7
Windows 7
Some of my users have problems starting my app (using the latest CEF4Delphi) under Windows 7, the EXE is started over and over again if i start a HTML5 Video. Is there any knowing problem under Systems < Windows 10? Or is every Windows Version > XP support?
And, what i also see is, that some users have install a anonymous proxy (Hotspot Shield). Chrome is not installed and if i install Chrome (the Backend from Google), this Plugin is automatically used by Chrome (i can see the "Disable" Button into Chrome Settings). Can i disable autoload Plugins?
And, what i also see is, that some users have install a anonymous proxy (Hotspot Shield). Chrome is not installed and if i install Chrome (the Backend from Google), this Plugin is automatically used by Chrome (i can see the "Disable" Button into Chrome Settings). Can i disable autoload Plugins?
- salvadordf
- Posts: 4067
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Windows 7
I watched an HTML5 video using the minibrowser demo in Windows 7 (32bit) from this web page : https://www.w3schools.com/html/html5_video.asp
While playing the video I could only see 3 processes created automatically by CEF3.
I can only guess that there's something wrong in the code inside your DPR file. Make sure you have something like this (notice the if..then clause) :
Code: Select all
GlobalCEFApp := TCefApplication.Create;
if GlobalCEFApp.StartMainProcess then
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end;
GlobalCEFApp.Free;
Code: Select all
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.StartMainProcess;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
GlobalCEFApp.Free;
TChromium has several properties to configure proxies : ProxyType, ProxyServer, ProxyPort, ProxyUsername, ProxyPassword, ProxyScriptURL, ProxyByPassList.Det20 wrote: ↑Thu Mar 23, 2017 3:12 pm And, what i also see is, that some users have install a anonymous proxy (Hotspot Shield). Chrome is not installed and if i install Chrome (the Backend from Google), this Plugin is automatically used by Chrome (i can see the "Disable" Button into Chrome Settings). Can i disable autoload Plugins?
What those properties do is modify the preferences as described here : https://www.chromium.org/administrators ... st-3#Proxy
The default value is CEF_PROXYTYPE_DIRECT which means "Never use a proxy" but if you want to make sure it's disabled, set TChromium.ProxyType := CEF_PROXYTYPE_DIRECT; every time you create a TChromium component.
Re: Windows 7
CEF_PROXYTYPE_SYSTEM = Use Windows Settings? If yes, this seems to be the best because if IE/Chrome can use internet, CEF4 can use it, too.
This is the way of my DPR. If Chromium is available, i set "ChromiumSupport" in my application. If this is set, i use Chromium, otherwise i use IE.
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.DeleteCache := true;
GlobalCEFApp.DeleteCookies := true;
GlobalCEFApp.FlashEnabled := true;
GlobalCEFApp.EnableSpeechInput := false;
GlobalCEFApp.EnableMediaStream := true;
StartedWithChromium := Assigned(GlobalCEFApp) and GlobalCEFApp.StartMainProcess;
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
frmMain.ChromiumSupport := StartedWithChromium;
Application.Run;
Try
If Assigned(GlobalCEFApp) then GlobalCEFApp.Free;
Except
End;
This is the way of my DPR. If Chromium is available, i set "ChromiumSupport" in my application. If this is set, i use Chromium, otherwise i use IE.
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.DeleteCache := true;
GlobalCEFApp.DeleteCookies := true;
GlobalCEFApp.FlashEnabled := true;
GlobalCEFApp.EnableSpeechInput := false;
GlobalCEFApp.EnableMediaStream := true;
StartedWithChromium := Assigned(GlobalCEFApp) and GlobalCEFApp.StartMainProcess;
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
frmMain.ChromiumSupport := StartedWithChromium;
Application.Run;
Try
If Assigned(GlobalCEFApp) then GlobalCEFApp.Free;
Except
End;
- salvadordf
- Posts: 4067
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Windows 7
That's correct, CEF_PROXYTYPE_SYSTEM means "Use system proxy settings" or "Use windows settings".
Remember that sometimes CEF3 creates delays during application startup due to network proxy resolution.
Read more about it in the 20th question of this FAQ :
http://magpcss.org/ceforum/viewtopic.php?f=6&t=10567
CEF4Delphi must be initialized with an if..then clause because the creation of subprocesses depends on that structure.Det20 wrote: ↑Fri Mar 24, 2017 1:43 pm This is the way of my DPR. If Chromium is available, i set "ChromiumSupport" in my application. If this is set, i use Chromium, otherwise i use IE.
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.DeleteCache := true;
GlobalCEFApp.DeleteCookies := true;
GlobalCEFApp.FlashEnabled := true;
GlobalCEFApp.EnableSpeechInput := false;
GlobalCEFApp.EnableMediaStream := true;
StartedWithChromium := Assigned(GlobalCEFApp) and GlobalCEFApp.StartMainProcess;
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
frmMain.ChromiumSupport := StartedWithChromium;
Application.Run;
Try
If Assigned(GlobalCEFApp) then GlobalCEFApp.Free;
Except
End;
The CEF3 application structure is explained here :
https://bitbucket.org/chromiumembedded/ ... -structure
CEF4Delphi simplifies all that into a single class (TCEFApplication) and a function (StartMainProcess)
The subprocesses will also execute the GobalCEFApp creation and initialization but StartMainProcess will return FALSE for them (True for the main application process). That way, only the main application process will get to the "Application.Initialize; ... Application.Run;" part.
In the previous link about the CEF3 application structure this is controlled by the result of CefExecuteProcess but it does the same thing.
If your application needs to detect if Chromium is available you can check if libcef.dll exists before creating GlobalCEFApp. Something like this :
Code: Select all
if FileExists('libcef.dll') then
begin
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.DeleteCache := true;
GlobalCEFApp.DeleteCookies := true;
GlobalCEFApp.FlashEnabled := true;
GlobalCEFApp.EnableSpeechInput := false;
GlobalCEFApp.EnableMediaStream := true;
if GlobalCEFApp.StartMainProcess then
begin
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
frmMain.ChromiumSupport := True;
Application.Run;
end;
GlobalCEFApp.Free;
end
else
begin
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
frmMain.ChromiumSupport := False;
Application.Run;
end;
Re: Windows 7
But what happens if i start the application the way i do? I think it's only to prevent the application to start over and over again, because GlobalCEFApp.StartMainProcess return false if application is already startet.
Maybe it's a good idea to make CheckCEFLibrary public (for use without create the class).
Maybe it's a good idea to make CheckCEFLibrary public (for use without create the class).
- salvadordf
- Posts: 4067
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Windows 7
By default, TCEFApplication is using the same EXE for the main process and for the subprocesses, as Chrome does.
That means that all of them will execute the code of your DPR file.
This is valid as long as only the main process initializes your application (the "Application.Initialize; ... Application.Run;" part)
If you allow all subprocesses to initlialize your application then you'll have the problem your users reported : multiple copies of the app running at the same time.
To avoid this problem, CEF4Delphi returns a different value in StartMainProcess : True for the main process and False for the subprocesses.
With a different value, only the main process initializes the application while the subprocesses remain inside the StartMainProcess function doing whatever they have to do (rendering, flash, etc) and then return False, skipping the initialization part.
I'll do that for the next version.
Re: Windows 7
Thank you. I'll wait for the changes and then re-try it.
What do you think: WIll my "will not play HTML5 videos"-Problem will be fixed if i change the DPR to your way? Or is this another problem?
What do you think: WIll my "will not play HTML5 videos"-Problem will be fixed if i change the DPR to your way? Or is this another problem?
- salvadordf
- Posts: 4067
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Windows 7
This will fix the problem with multiple application copies running at the same time.
Test it in a controlled environment to check if HTML5 video plays correctly. Remember that the CEF3 binaries from spotify only support open source codecs.
Test it in a controlled environment to check if HTML5 video plays correctly. Remember that the CEF3 binaries from spotify only support open source codecs.