Ubuntu16.04 using Qt 5.5.1 can not play HTML5 video
-
![Hi guys,
I have a pcduinov3B arm shield( like raspberry,gcc toolchain is arm-linux-gnueabihf-gcc5),I have updated the system to ubuntu 16.04 and make a project to play html5 video,but I can only open the webpage,can not play it when click the play button.
Here is what I've done:- install libqt5webkit5-dev
2.install libqt5multimedia5
3.change user-agent to an android user-agent to make the video page an html5 video page
4.use qtcreator build the project and test
I place this project to a raspberry pi3 shield ,the video can be played normally!Can anyone help me ?This makes me crazy!
- install libqt5webkit5-dev
-
here is the code:
qtweb.pro
QT += core gui webkitwidgets
QT+= network
QT += widgets
#QT += multimediagreaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = qtweb
TEMPLATE = appSOURCES += main.cpp
mainwindow.cpp
browsercontrol.cppHEADERS += mainwindow.h
browsercontrol.hFORMS += mainwindow.ui
browsercontrol.h
#ifndef BROWSERCONTROL_H
#define BROWSERCONTROL_H
#include <QtWebKitWidgets/QWebView>
#include <QtWebKitWidgets/QWebPage>class webPage : public QWebPage {
public: webPage();
QString userAgentForUrl(const QUrl &url )const;
};class browserControl : public QWebView {
public: browserControl();
};
#endif // BROWSERCONTROL_Hbrowsercontrol.cpp
#include "browsercontrol.h"
#include <QtWebKitWidgets/QWebView>
#pragma comment(lib,"Qt5Widgets.lib")
#pragma comment(lib,"Qt5WebKitWidgets.lib")
#include <QtWebKitWidgets/QWebPage>browserControl::browserControl() {
QWebView:QWebView();
}
QString webPage::userAgentForUrl(const QUrl &url ) const {
//return QString("Mozilla/5.0 (Linux; U; Android 4.4.4; zh-cn; HTC_D820u Build/KTU84P) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30");
return QString("Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03S) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19");
}
webPage::webPage(){
QWebPage:QWebPage();
}main.cpp
#include "mainwindow.h"
#include <QApplication>
#include <QtCore/QUrl>
#include <QtWebKitWidgets/QWebView>
#pragma comment(lib,"Qt5Widgets.lib")
#pragma comment(lib,"Qt5WebKitWidgets.lib")
#pragma comment(lib,"Qt5Multimedia5")
#include"browsercontrol.h"
#include <QNetworkProxy>int main(int argc, char argv[])
{
QApplication a(argc, argv);
/ MainWindow w;
w.show();*/
QApplication::addLibraryPath("./plugins");
browserControl webControl = new browserControl();
webPage * page = new webPage();
//webControl->resize(1000, 500);
webControl->setPage((QWebPage)page);//webControl->page()->mainFrame()->evaluateJavaScript("qtCallJs()"); QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true); webControl->settings()->setAttribute(QWebSettings::PluginsEnabled, true); webControl->settings()->setAttribute(QWebSettings::WebGLEnabled, true); webControl->settings()->setAttribute(QWebSettings::WebAudioEnabled, true); webControl->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true); webControl->settings()->setLocalStoragePath("/home/html/"); webControl->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); webControl->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); webControl->settings()->setMaximumPagesInCache(0); webControl->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); //webControl->load(QUrl("http://218.206.179.109/ctp-testResult")); //webControl->load(QUrl("http://html5test.com/")); //webControl->load(QUrl("http://chrome.360.cn/test/html5/index.html"));
//webControl->load(QUrl("http://www.iqiyi.com"));
//webControl->load(QUrl("http://camendesign.com/code/video_for_everybody/test.html"));
//webControl->load(QUrl("http://192.168.92.106/h5video.html"));
webControl->load(QUrl("http://211.136.90.52/videojs1.html"));
//webControl->load(QUrl("http://tv.sohu.com"));
webControl->show();
//webControl->showMaximized();/* //1?????QWebView??
QWebView *pWebView = new QWebView();
//?????????????QT?????????????
pWebView->load(QUrl("http://qt-project.org/"));//?????? //pWebView->load(QUrl("qrc:/form.html")); //???? pWebView->show();*/ return a.exec();
}
-
I got these warnings here:
Starting /home/linaro/build-qtweb-ubuntu-Debug/qtweb...
libEGL warning: DRI3: Screen seems not DRI3 capable
libEGL warning: DRI2: failed to open mali_drm (search paths /usr/lib/arm-linux-gnueabihf/dri:${ORIGIN}/dri:/usr/lib/dri)And I also use tcpdump to capture packets,I can see the throughput from the server,but video can not play. I think this may be the decode problem but not very clear.Do I need to put some so files into the debug/plugins folder?
Any answers will be appreciated!
-
@FrankiPL
I suspect @speeter will have long disappeared, as that post was a year ago :)Just a thought: have a look at (the first part of) https://raspberrypi.stackexchange.com/a/61086, which claims it's a generic Linux problem rather than just a RPi one. It's not quite the same messages, but worth investigating?