QWebEngineView 加载 flash插件参数配置

您所在的位置:网站首页 打开网页提示该插件不受支持 QWebEngineView 加载 flash插件参数配置

QWebEngineView 加载 flash插件参数配置

2023-09-06 11:48| 来源: 网络整理| 查看: 265

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


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3