Nominate our 2022 Qt Champions!

QML Audio is not able to access mp3 file in qrc (windows)

  • Hi,

    I am using QML audio to playback mp3 file in qrc. The same code works fine in Mac, iOS and Android. But not in Windows. I am compiling with VC2012 Express in Windows 7.

    If the source file directs to local storage ("file:///../...mp3"), it runs normally. Just not in qrc ("qrc:///.../...mp3")
    Does anyone know how to solve this?

    Thank you.

    (P.S. my post is lost, thus I post the question again. If this question is duplicated, please kindly remove the topic. Thank you.)

  • Lifetime Qt Champion


    That might be a backend limitation, can you check whether you have the DirectX or WMF plugin loaded ?

  • Thanks for reply.

    I do have wmfengine.dll installed in plugins\mediaservice directory.
    But when I run listDLLs to check my program, there is no WMF or DirectShow related dll loaded, however Qt5Multimedia.dll did have loaded.

    WMF might case the qrc issue? Because it plays normally with files under physical directory.


  • Lifetime Qt Champion

    Do you also have the DirectX plugin ?

    From a quick code check the WMF should handle the qrc case

  • @Albus It might be a path error. Check if the file is indeed in your qrc file and check that you're using the right prefix.

  • @raf924 Thanks for your advice. I am sure the path is correct, since it works normally in other 3 platforms.

  • @SGaist Do you mean "dsengine.dll"? I do have this DirectShow plugin installed.
    And this dll is not loaded while running my program.

  • Lifetime Qt Champion

    Then try to move it of the multimedia plugin folder to ensure that the WMF plugin gets loaded

  • @SGaist I renamed these dll, nothing special happened, the program ran normally (but when playing the mp3 file, the error was : MediaPlayer fail to load source).

    Actually, early before when I first tried to run my program, it failed to load every dll it needed, thus I had to copy all dll to have a fast try. But WMF and DS dlls are never asked.

  • Lifetime Qt Champion

    Starting your application with QT_DEBUG_PLUGINS set to 1 will show you what gets loaded

  • @SGaist Thanks for the hint. I searched the entire output, not wmf, not dsengine is found.

  • Lifetime Qt Champion

    Which are loaded ?

  • @SGaist here is the list:
    loaded library "C:/Qt/Qt5.5.1/5.5/msvc2012/qml/QtQuick.2/qtquick2plugind.dll"
    C:/Qt/Qt5.5.1/5.5/msvc2012/qml/QtQuick/Controls/qtquickcontrolsplugind.dll, metadata=
    C:/Qt/Qt5.5.1/5.5/msvc2012/qml/QtQuick/Window.2/windowplugind.dll, metadata=
    loaded library "C:/Qt/Qt5.5.1/5.5/msvc2012/qml/QtQuick/Window.2/windowplugind.dll"
    C:/Qt/Qt5.5.1/5.5/msvc2012/qml/QtQuick/Layouts/qquicklayoutsplugind.dll, metadata=
    C:/Qt/Qt5.5.1/5.5/msvc2012/qml/Qt/labs/folderlistmodel/qmlfolderlistmodelplugind.dll, "C:/Qt/Qt5.5.1/5.5/msvc2012/qml/Qt/labs/folderlistmodel/qmlfolderlistmodelplugind.dll"
    loaded library "C:/Qt/Qt5.5.1/5.5/msvc2012/plugins/bearer/qgenericbearerd.dll"
    loaded library "C:/Qt/Qt5.5.1/5.5/msvc2012/plugins/bearer/qnativewifibearerd.dll"
    loaded library "wlanapi"

  • Lifetime Qt Champion

    What code are you using to play that audio file ?

  • @SGaist here is my code :

    MediaPlayer {
        id: music
        autoPlay: true
        source: "qrc:///musics/musics/Highway_Wildflowers.mp3"
        loops: Audio.Infinite
        volume: 0.6 * CallBacks.getFastAudioSettings()[1]

  • Lifetime Qt Champion

    Then it probably is using the audio plugin which I'm not sure at all is supporting qrc