Page 1 of 1

How to play flash with JCEF

PostPosted: Mon Aug 28, 2017 10:00 am
by WeiLi
I have Swing embedded browser application which is implemented using JCEF, it does not play flash, how to make it support flash? The following is my code. My system is Windows 10
CefSettings settings = new CefSettings();
settings.cache_path="d:/cefCache";
String[] args={
// "--ppapi-flash-path=\"C:\\Users\\wei\\AppData\\Local\\Google\\Chrome\\User Data\\PepperFlash\\26.0.0.151\\pepflashplayer.dll\"",
// "--ppapi-flash-version=26.0.0.151",
"--enable-system-flash=true",
"--plugin-policy=allow"
};
String startURL="http://saizenmedia.com/fubon/";
// String startURL="http://192.168.86.27:8086/?name=keno";
CefApp cefApp = CefApp.getInstance(args,settings);
CefClient client = cefApp.createClient();
CefBrowser browser = client.createBrowser(startURL, false, false);
Component browerUI = browser.getUIComponent();
JTextField address = new JTextField(startURL, 100);
address.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
browser.loadURL(address.getText());
}
});
getContentPane().add(address, BorderLayout.NORTH);
getContentPane().add(browerUI, BorderLayout.CENTER);
pack();
setSize(800,600);
setVisible(true);

Re: How to play flash with JCEF

PostPosted: Mon Aug 28, 2017 12:12 pm
by magreenblatt
Install the "Opera and Chromium PPAPI" version from https://get.adobe.com/flashplayer/otherversions/ and then run CEF with the `--enable-system-flash` command-line flag.

Re: How to play flash with JCEF

PostPosted: Tue Aug 29, 2017 9:09 am
by WeiLi
magreenblatt wrote:Install the "Opera and Chromium PPAPI" version from https://get.adobe.com/flashplayer/otherversions/ and then run CEF with the `--enable-system-flash` command-line flag.


I do have "Opera and Chromium PPAPI" version flash installed
I have downloaded the builds from here http://opensource.spotify.com/cefbuilds/index.html
The flash is playing fine when I use cefclient.exe with "--enable-system-flash"

But Java is my language of choice for my application, hence JCEF. It seems the flag "--enable-system-flash" is lost between JCEF and CEF.
Any suggestion?

Re: How to play flash with JCEF

PostPosted: Tue Aug 29, 2017 12:51 pm
by WeiLi
The problem was the following code which was not posted. It works fine once I replaced the null with args

Code: Select all
CefApp.addAppHandler(new CefAppHandlerAdapter(null) {
        @Override
        public void stateHasChanged(org.cef.CefApp.CefAppState state) {
            if (state == CefAppState.TERMINATED){
                System.exit(0);
            }
        }
    });