QWebEngineView 加载 flash插件参数配置
QWebEngineView 加载 flash插件参数配置官网http://doc.qt.io/qt-5/qtwebengine-features.htmlQt WebEngine 特性主要看 ppapiPepper Plugin APIQt WebEngine supports loading Pepper Plugin API (PPAPI) plugins if WebEng...
QWebEngineView 加载 flash插件参数配置
官网
http://doc.qt.io/qt-5/qtwebengine-features.html
Qt WebEngine 特性
主要看 ppapi
Pepper Plugin API
Qt WebEngine supports loading Pepper Plugin API (PPAPI) plugins if WebEngineSettings::pluginsEnabled or QWebEngineSettings::PluginsEnabled is set.
如果WebEngineSettings::pluginsEnabled 或 QWebEngineSettings::PluginsEnabled 设置为true
Qt WebEngine就支持加载ppapi插件代码,能开的都开开
QWebEngineSettings *websetting1 = QWebEngineSettings::defaultSettings();
websetting1->setAttribute(QWebEngineSettings::PluginsEnabled, true);
QWebEngineSettings *websetting = QWebEngineSettings::globalSettings();
websetting->setAttribute(QWebEngineSettings::PluginsEnabled, true);
QWebEngineView *view = new QWebEngineView(this);
ui->verticalLayout->addWidget(view);
view->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
Except for the Adobe Flash Player plugin, the plugins must be loaded manually using the Chromium command line syntax with the --register-pepper-plugins argument.
除了flash插件外,其它插件必须手动加载,使用Chromium命令行语法,添加--register-pepper-plugins参数。
感觉官方说flash是不需要手动设置的
于是加载测试页面看看
代码
view->load(QUrl("https://helpx.adobe.com/flash-player.html"));
没有参数时
页面测试结果
Flash Player is pre-installed in Google Chrome, but not enabled.
You can skp the steps below. See Enable Flash Player on Google Chrome.
flash区域是
Couldn't load plugin
添加参数
--register-pepper-plugins="/usr/lib/adobe-flashplugin/libpepflashplayer.so;application/x-shockwave-flash"
页面测试结果
Flash Player is pre-installed in Google Chrome, but not enabled.
You can skp the steps below. See Enable Flash Player on Google Chrome.
flash区域是
Couldn't load plugin
但本地flash可以显示(意外)
添加参数
--register-pepper-plugins="/usr/lib/adobe-flashplugin/libpepflashplayer.so;application/x-shockwave-flash" --ppapi-flash-path="/usr/lib/adobe-flashplugin/libpepflashplayer.so"
页面测试结果
Flash Player is pre-installed in Google Chrome and updates automatically!
You can skip the steps below. See Flash Player with Google Chrome.
本地和网络都可显示
如果参数只有
--ppapi-flash-path="/usr/lib/adobe-flashplugin/libpepflashplayer.so"
虽然页面测试结果提示正确
Flash Player is pre-installed in Google Chrome and updates automatically!
You can skip the steps below. See Flash Player with Google Chrome.
但flash区域是
Couldn't load plugin可以在运行时添加参数
测试也可以在main函数里添加参数
int main(int argc, char *argv[])
{
int numArg = argc;
int addargc=2;
char *addargv[addargc]={
"--register-pepper-plugins=/usr/lib/adobe-flashplugin/libpepflashplayer.so;application/x-shockwave-flash",
"--ppapi-flash-path=/usr/lib/adobe-flashplugin/libpepflashplayer.so"};
int myargc=numArg+addargc;
char *myargv[myargc];
cout<<"The total number of command arguments is: "<<numArg<<endl;
for(int i = 0;i<numArg;i++) {
cout<<"Argument # "<<i<<argv[i]<<endl;
myargv[i]=argv[i];
}
for(int i = 0;i<addargc;i++) {
myargv[numArg+i]=addargv[i];
}
QApplication a(myargc, myargv);
MainWindow w;
w.show();
return a.exec();
}
更多推荐
所有评论(0)