Unsolved Play video inside qrc resources not working
-
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
-
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.
-
Thank you for your response. In android the same happens , what is the solution? Thanks
-
The same I already suggested, copy the file to a temporary folder.
You can use QStandardPaths for that.
-
@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.