Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMediaPlayer Seek to a position before playing video



  • I want to seek to a position when video is paused and played again.
    I have added below code to set position and play media

    player->setPosition(pos);
    player->play();
    

    However, it would show first frame before seeking to new position.
    For e.g. I paused video at 100 ms. Now when I set position to 150 ms, first 100 ms frame will be displayed before continuing video smoothly from 150 ms.
    Is there any way, I avoid displaying frame at 100 ms ?


  • Lifetime Qt Champion

    Hi,

    What version of Qt ?
    What platform are you running on ?
    What type of video ?



  • @SGaist ,

    Qt version 5.12 with MSVC 2017
    Platform : Windows
    any kind of video . e.g .avi, .mp4


  • Lifetime Qt Champion

    Can you check which multimedia backend is loaded ?

    For that, set the QT_DEBUG_PLUGINS environment variable to 1 in the Run part of the Project panel.



  • @SGaist said in QMediaPlayer Seek to a position before playing video:

    QT_DEBUG_PLUGIN

    This is the log I get after following above procedure

    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.0/5.12.0/msvc2017_64/plugins/mediaservice/dsengine.dll"
    Found metadata in lib C:/Qt/Qt5.12.0/5.12.0/msvc2017_64/plugins/mediaservice/dsengine.dll, metadata=
    {
        "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
        "MetaData": {
            "Keys": [
                "directshow"
            ],
            "Services": [
                "org.qt-project.qt.camera",
                "org.qt-project.qt.mediaplayer"
            ]
        },
        "archreq": 0,
        "className": "DSServicePlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("directshow")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.0/5.12.0/msvc2017_64/plugins/mediaservice/dsengined.dll"
    Found metadata in lib C:/Qt/Qt5.12.0/5.12.0/msvc2017_64/plugins/mediaservice/dsengined.dll, metadata=
    {
        "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
        "MetaData": {
            "Keys": [
                "directshow"
            ],
            "Services": [
                "org.qt-project.qt.camera",
                "org.qt-project.qt.mediaplayer"
            ]
        },
        "archreq": 1,
        "className": "DSServicePlugin",
        "debug": true,
        "version": 330752
    }
    

  • Lifetime Qt Champion

    From a quick look at the code, I would say that the behaviour is normal (although not what you'd want) with regard to how it's implemented.



  • @SGaist

    is there any other way to achieve expected behaviour ?


  • Lifetime Qt Champion

    You would likely have to fiddle with the backend code.


Log in to reply