Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Can QWebEngineView load and play local multimedia files?

[Solved]Can QWebEngineView load and play local multimedia files?

Scheduled Pinned Locked Moved General and Desktop
qwebengineview
8 Posts 3 Posters 6.9k 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.
  • U Offline
    U Offline
    unixman
    wrote on last edited by unixman
    #1

    Hi.
    i know about security but it is no problem for me.
    i was tried with varius ways but no success.
    eg.
    From html:
    <video crossorigin='blah' src='foo.mp4'/>
    From js:

    var filepicker = document.getElementById("file").files[0]
    var player = document.getElementById("player")
    player.src = URL.createObjectURL(filepicker)
    

    From cpp:

    QtWebEngine::initialize();
    QWebEngineView* web = new QWebEngineView();
    web->page()->settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls,true);
    web->page()->setFeaturePermission(QUrl("file:///home/me/test.html"),QWebEnginePage::MediaAudioVideoCapture,QWebEnginePage::PermissionGrantedByUser);
    

    When page loaded i can see video element. But it seems like disabled as no 'src'.
    But everythings fine with youtube.
    Are there a way for this?

    Thanks.

    1 Reply Last reply
    0
    • U Offline
      U Offline
      unixman
      wrote on last edited by
      #2

      Well. 'ogg' audios and 'webm' videos are playable but 'mp3' and 'mp4' formats not playable.

      Are 'mp3' and 'mp4' formats banned by Qt devs? If so; is because legal/third-party issues?

      Similar q already asked there.

      https://forum.qt.io/topic/52487/mp4-playback-disabled-by-default-ubuntu-windows/2

      Thanks a lot.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Here you have the explanation

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • U Offline
          U Offline
          unixman
          wrote on last edited by
          #4

          @SGaist: that's exact answer i am looking for. Thank you.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            asht
            wrote on last edited by
            #5

            Hi,

            I am also trying to play mp3/mp4 files from html using Qwebengineview. I am working on Qt5.6 on windows 7. So only building with codec option will be only solution?

            Please let me know on this issue in detail.

            Thanks

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              It's also explained in the QtWebEngine Features documentation in the chapter about proprietary codecs.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • A Offline
                A Offline
                asht
                wrote on last edited by
                #7

                Hi Sgaist,
                So according to documentation, apart from building Qtwebengine with given option is there any other way? It is also stating about ffmpeg. Does it can be used?

                Thanks

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  AFAIK yes, but you still need a build of ffmpeg that supports h.264.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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