Qt World Summit: Register Today!

QMediaPlayer stays in UnknownMediaStatus on Windows 7

  • I created a very simple video player in Qt (C++) on my win10 and it all worked fine, until I exported it to another computer win7, so I tried on win8 and it still worked but not win7.

    Sadly, since I need to release my application to win7, this is very hard for me to debug. I then simplified the code to that:

    QMediaPlayer * mp = new QMediaPlayer();
    mp->mediaStatus(); // returns 1 (=NoMedia) on win8/win10 but 0 (=UnknownMediaStatus) on win7

    I use QtCreator 4.6.1 and I know it's old but I cannot upgrade yet.

    Thanks in advance.

  • Lifetime Qt Champion

    @QuentinJanuel said in QMediaPlayer stays in UnknownMediaStatus on Windows 7:

    I use QtCreator 4.6.1 and I know it's old but I cannot upgrade yet.

    This is actually quite up to date QtCreator version.
    I guess you mean Qt version, but Qt != QtCreator.
    But don't use "Help/About Qt Creator..." to find out which Qt version you're using. Check your Kit for that.

    How did you deploy your app?
    Take a look at https://doc.qt.io/Qt-5/windows-deployment.html

  • It says I use the Qt version 5.4.2, and MSVC2010 as my compiler.
    This is not a personal project and therefore I can't change any of those configurations.

    Also yes I did deploy it, that's how I exported it to windows 7.
    Once again, if I open the output executable on win8 it all works fine (I mean I just log the QMediaPlayer's status and it is "NoMedia" (aka 1)). But if I run the exact same exe on windows 7 it logs "UnknownMediaStatus".

    I'm almost sure that's were the issue is since before I had made the entire video player and it worked in win8/10 but not 7. So I tried to isolate where it started to go wrong and there we are.

    Perhaps there is a way to see the log messages (if eventually a warning or an error occures), but since I deploy it as an exe I can't see anything (I used a label to manually print the MediaPlayer's status).

    Also this windows 7 is very slow VM, there is no way I can install QtCreator on it to check it out, unfortunately.

  • Here is pretty much the commands I use to deploy the app:

    qmake videoplayer/videoplayer.pro -o build/MakeFile -r -spec win32-msvc2010 -nocache
    jom -f Makefile -s
    windeployqt --release release