Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Play video inside qrc resources not working
Forum Updated to NodeBB v4.3 + New Features

Play video inside qrc resources not working

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 Posters 799 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    albertabac
    wrote on last edited by
    #1

    Hello,

    I am trying to play a local video file from local resources. When I play it from an absolute path it works , but when I try to load it from the qrc path it does not work.
    What works:

                Video
                {
                    id:video
                    ......
                    source: "C://Users//Startup//Downloads//Video1.WMV"
                }
    

    What does not work:

                Video
                {
                    id:video
                    ......
                    source: "qrc:/videos/Video1.WMV"
    
                }
    

    I have added the video in the qrc file:

    <RCC>
    <qresource prefix="/">

    ....
    <file>videos/Video1.WMV</file>
    </qresource>
    </RCC>

    And I can load images inside the folder video without problems.
    I have run qmake after each change, and I have tried cleaning and recompiling.

    Any help would be really appreciated!

    Thank you in advance

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

      Hi and welcome to devnet,

      That's because the Windows Media Foundation API doesn't know how to access qrc files. You have to copy the file in a temporary folder and play it from there.

      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
        albertabac
        wrote on last edited by
        #3

        Thank you for your response. In android the same happens , what is the solution? Thanks

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

          The same I already suggested, copy the file to a temporary folder.

          You can use QStandardPaths for that.

          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 albertabac

            Thank you for your response. In android the same happens , what is the solution? Thanks

            Bhushan_SureB Offline
            Bhushan_SureB Offline
            Bhushan_Sure
            wrote on last edited by
            #5

            @albertabac Hi, For taking the absolute path, in QT, in qrc, right click on your video file and select copy and then in code where you are giving path, paste it there, it will take the path automatically.

            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