Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Ubuntu16.04 using Qt 5.5.1 can not play HTML5 video
QtWS25 Last Chance

Ubuntu16.04 using Qt 5.5.1 can not play HTML5 video

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
ubuntuqt5.5.1linuxqtmultimediahtml5
5 Posts 3 Posters 2.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    speeter
    wrote on 22 Feb 2017, 06:07 last edited by A Former User
    #1

    ![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:

    1. 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!
    1 Reply Last reply
    0
    • S Offline
      S Offline
      speeter
      wrote on 22 Feb 2017, 06:20 last edited by
      #2

      here is the code:
      qtweb.pro
      QT += core gui webkitwidgets
      QT+= network
      QT += widgets
      #QT += multimedia

      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

      TARGET = qtweb
      TEMPLATE = app

      SOURCES += main.cpp
      mainwindow.cpp
      browsercontrol.cpp

      HEADERS += mainwindow.h
      browsercontrol.h

      FORMS += 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_H

      browsercontrol.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();
      

      }

      1 Reply Last reply
      0
      • S Offline
        S Offline
        speeter
        wrote on 22 Feb 2017, 06:25 last edited by
        #3

        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!

        1 Reply Last reply
        0
        • F Offline
          F Offline
          FrankiPL
          wrote on 17 May 2018, 15:39 last edited by FrankiPL
          #4

          Hi

          I have similar issue:

          libEGL warning: DRI2: failed to open mali_drm

          have you found a solution ?

          Best,
          Marek

          JonBJ 1 Reply Last reply 18 May 2018, 12:11
          0
          • F FrankiPL
            17 May 2018, 15:39

            Hi

            I have similar issue:

            libEGL warning: DRI2: failed to open mali_drm

            have you found a solution ?

            Best,
            Marek

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on 18 May 2018, 12:11 last edited by
            #5

            @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?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved