Congratulations to our 2022 Qt Champions!

Weird QMediaPlayer::setPosition behavior

  • Hi all,

    I was trying out one of the examples delivered with Qt 5.2.1 sources - example/multimediawidgets/player.
    I have encountered some weird behavior which looks like a bug.

    When the playback is started, QMediaPlayer::positionChanged(qint64) is delivered regularly (every sec or so).
    Now, when you PAUSE the playback and drag the slider QMediaPlayer::setPosition(qint64) is called with new offset.

    And now two funny things:

    • player automatically resumes playback, however NO positionChanged signal is emitted anymore
    • despite the resumed playback, if state of the player is checked via QMediaPlayer::state(), QMediaPlayer::PausedState is reported

    I have observed this on my Windows 7 64bit machine. Qt sources built with MSVC 2010 in 32-bit mode.

    Is it a bug or intended behavior ?

  • Lifetime Qt Champion


    I don't think that it's the intended behavior. Can you check again with 5.6 Beta if it's still happening ?

  • @SGaist Sure, I am building sources now. However, I have already encountered some build problems with generated makefiles. I'll try to tweak them to continue with the rest of the process. If I succeed I'll make a new test and let you know.

    EDIT: I wasnt able to build the Qt 5.6 beta sources in the end. It seems the QMake generates some buggy makefiles.
    Basically, compilation fails in many place due to the same issue:

     (set QT_PLUGIN_PATH=D:\Work\Test\qt-everywhere-opensource-src-5.6.0-beta\qtbase\plugins) & (set PATH=D:\Work\Test\qt-everywhere-opensource-src-5.6.0-beta\qtbase\bin;%PATH:)=^)%) & D:\Work\Test\qt-everywhere-opensource-src-5.6.0-beta\qtbase\bin\uic.exe controller.ui -o .uic\ui_controller.h
    NMAKE : fatal error U1077: '(set' : return code '0xc0000135' Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'

    I have compared the generated makefiles with my 5.2.1 build and it seems the problem lies in PATH setting:

    In 5.2.1 generated makefilesI can see the following:

    set PATH=D:\Work\Test\qt-everywhere-opensource-src-5.6.0-beta\qtbase\lib;%%PATH:)=^)%%

    while in 5.6-beta there is a small change:

    set PATH=D:\Work\Test\qt-everywhere-opensource-src-5.6.0-beta\qtbase\bin;%%PATH:)=^)%%

    Fixing it to what can be seen in 5.2.1 allows the target to build successfully. However, more and more targets suffer from the same issue later on.

    Is it something with my setup ?

  • Ok. I finally managed to build the 5.6 beta sources. It seems 5.6-beta DOES NOT suffer from the same problem.

  • Lifetime Qt Champion

    Good news ! :)

    In that case, please mark the thread as solved using the "Topic Tool" button so other forum users may know that a solution has been found :)

  • @SGaist Will do. Thank you!