martes, 3 de noviembre de 2015

How to enable PPAPI Flash support in DCEF3 branch 2454

DCEF3 branch 2454 now introduces Chromium version 45 which was announced a few hours ago by the author of DCEF Henri Gourvest and it is awesome.

However, I noticed that Flash was not working anymore, so digging in CEF and Chromium forums I found out that Chromium version 45 officially dropped NPAPI support, but it still supports PPAPI, so we need to add --enable-system-flash to our program's executable shortcut (command line params) in order to enable Flash again for our program.
Notice: we might need to make sure to use CefCommandLineArgsDisabled := False; ( Cef Command Line support is enabled ) in our project source in order to use that parameter mentioned above, but it is False by default, so we don't need to worry, but who knows, you might have had disabled it for some reason xD.
A system-wide installation of Pepper Flash that will be automatically discovered and loaded by CEF on Windows and OS X can be downloaded from (choose "FP for Opera and Chromium -- PPAPI") in Step 2). To enable use the system-wide installation pass the --enable-system-flashcommand-line argument. — Marshall Greenblatt
But there is another alternative, which will help us to add those command line arguments before starting chromium, and get rid of unwanted command lines or shortcuts (.lnk) that the user should include to enable Flash in our program.
Just like adding a custom path for our cache directory, we also need to modify the Project's source.
This is the event we need to modify:
By default is set to nil so we will need a custom procedure to add that switcher (--enable-system-flash or any other one you might also need) to our chromium component.
So it will look something like this:
program guiclient;
procedure CustomCommandLine (const processType: ustring; const commandLine: ICefCommandLine);
    commandLine.AppendSwitch('--enable-system-flash'); // since it doesn't need any value, that's enough, otherwise use AppendSwitchWithValue(switch, value);
    CefCache := 'cache';
    CefOnBeforeCommandLineProcessing := CustomCommandLine;
    CefSingleProcess := False;
       if not CefLoadLibDefault then Exit;
That's it, now we will have PPAPI Flash working again in our project.

More about CefCommandLine at