How to play flash with JCEF
Posted: Mon Aug 28, 2017 10:00 am
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);
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);