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

QMedia player not working



  • Hello, I have some code to play sound:

        QMediaPlayer* _player = new QMediaPlayer(this, QMediaPlayer::StreamPlayback);
        connect(_player, QOverload<QMediaPlayer::Error>::of(&QMediaPlayer::error),
              [=](QMediaPlayer::Error error)
        { /* ... */
            int x = 0;
        });
        QUrl file = QUrl::fromLocalFile(QFileDialog::getOpenFileName(this, tr("Open Music"), "", tr("")));
        if (file.url() == "")
            return ;
        _player->setMedia(file);
        _player->setVolume(100);
        _player->play();
    

    but the sound is not reproduced. I get an error: ServiceMissingError.
    I install vlc player,k-lite codecs, gstream,pot player, but the effect is zero, the sound also does not play, what do I need to set so that the sound plays?


  • Lifetime Qt Champion

    Hi,

    What version of Qt ?
    What OS ?
    How did you install Qt ?
    What file format is failing ?



  • this works. Do not forget to install all plugins for qt multimedia.

    if ( nullptr == m_mediaPlayer ) {   
        m_playList = new QMediaPlaylist();
        m_playList->setPlaybackMode( QMediaPlaylist::CurrentItemOnce ); /* or QMediaPlaylist::Loop */
        m_playList->addMedia( QUrl::fromLocalFile( m_fileName ) );
       
        m_mediaPlayer = new QMediaPlayer;
        m_mediaPlayer->setPlaylist( m_playList );
       m_mediaPlayer->play();
    }


  • @SGaist Qt = 5.13.2; Windows 10; install from qt-installer; .mp3
    Everything works on another computer, but for some reason it’s not working, on the Internet they write about the absence of any drivers, but which ones no one can say for sure
    @JoeCFD how install and what plugins?



  • Do you have Qt installed in this computer or you just copy the exe and dll files?
    It looks like the mediaservice plugins cannot be found.



  • @Bonnie ,of course yes I have install qt. I have Qt5Multimedia.dll, plugins/mediaservice/qtmedia-audioengine.dll



  • @architect23
    What about plugins/mediaservice/dsengine.dll then?
    That's the one used for player.
    And try to check if it is loaded successfully.



  • @Bonnie , yes I have plugins/mediaservice/dsengine.dll
    How i check is load it or not?



  • @architect23 said:

    How i check is load it or not?

    As we usually do to debug plugin loading issues:
    Set the QT_DEBUG_PLUGINS environment variable to 1
    Then run the app, play the file, and check the diagnostic information from output.



  • @Bonnie said in QMedia player not working:

    QT_DEBUG_PLUGINS

    defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
    what I must do for this???



  • @architect23
    Is there any plugin-related info?



  • @Bonnie said in QMedia player not working:

    Is there any plugin-related info?

    except that I see no information there


  • Lifetime Qt Champion

    You should have a list of all the plugins that are getting scanned and loaded.



  • @SGaist ,how to get this list, which team?


  • Qt Champions 2019

    @architect23 said in QMedia player not working:

    how to get this list

    If you set QT_DEBUG_PLUGINS and then start your app you will get it as output of your app. See https://doc.qt.io/qt-5/deployment-plugins.html
    If you start your app from QtCreator then set it in Run settings of your project.
    If you start it in a terminal then set the variable there and then start your app.



  • @jsulm ,
    QMediaPluginLoader: Inserting new list for key: "org.qt-project.qt.audiodecode"
    Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\dsengined.dll: The specified module could not be found.
    QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/mediaservice/dsengined.dll" : "Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\dsengined.dll: The specified module could not be found."
    Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\wmfengined.dll: The specified module could not be found.
    QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/mediaservice/wmfengined.dll" : "Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\wmfengined.dll: The specified module could not be found."
    QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.mediaplayer" : ("directshow")
    defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"


  • Qt Champions 2019

    @architect23 Did you build in debug mode? It looks like it does not find debug versions of some DLLs.
    Try to build in release mode and see whether it works then.



  • @jsulm in Release:
    Got keys from plugin meta data ("windowsmediafoundation")
    QMediaPluginLoader: loading metadata for iid "org.qt-project.qt.mediaserviceproviderfactory/5.0" at location "/mediaservice"
    QMediaPluginLoader: Inserted index 0 into metadata: QJsonObject({"Keys":["directshow"],"Services":["org.qt-project.qt.camera","org.qt-project.qt.mediaplayer"],"index":0})
    QMediaPluginLoader: Inserting new list for key: "org.qt-project.qt.camera"
    QMediaPluginLoader: Inserting new list for key: "org.qt-project.qt.mediaplayer"
    QMediaPluginLoader: Inserted index 1 into metadata: QJsonObject({"Keys":["audiocapture"],"Services":["org.qt-project.qt.audiosource"],"index":1})
    QMediaPluginLoader: Inserting new list for key: "org.qt-project.qt.audiosource"
    QMediaPluginLoader: Inserted index 2 into metadata: QJsonObject({"Keys":["windowsmediafoundation"],"Services":["org.qt-project.qt.mediaplayer","org.qt-project.qt.audiodecode"],"index":2})
    QMediaPluginLoader: Inserting new list for key: "org.qt-project.qt.audiodecode"
    Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\dsengined.dll: The specified module could not be found.
    QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/mediaservice/dsengined.dll" : "Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\dsengined.dll: The specified module could not be found."
    Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\wmfengined.dll: The specified module could not be found.
    QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/mediaservice/wmfengined.dll" : "Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\wmfengined.dll: The specified module could not be found."
    QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.mediaplayer" : ("directshow")
    defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/m.senin/source/repos/QtTest/untitled/debug/accessible" ...
    mincore\com\oleaut32\dispatch\ups.cpp(2125)\OLEAUT32.dll!00007FFF110B491B: (caller: 00007FFF110B4A92) ReturnHr(1) tid(623c) 8002801D Library not registered.
    shell\comdlg32\fileopensave.cpp(14414)\comdlg32.dll!00007FFF10F0A278: (caller: 00007FFF10F38311) ReturnHr(1) tid(623c) 80004005 Unspecified error
    CallContext:[\PickerModalLoop]
    QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.mediaplayer" : ("directshow")
    QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.mediaplayer" : ("directshow")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/accessiblebridge" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/m.senin/source/repos/QtTest/untitled/debug/accessiblebridge" ...
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/styles/qwindowsvistastyled.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qgifd.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qicnsd.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qicod.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qjpegd.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qsvgd.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qtgad.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qtiffd.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qwbmpd.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qwebpd.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/platforms/qwindowsd.dll"


  • Qt Champions 2019

    @architect23 It still tries to load debug DLLs.
    Did you a complete rebuild after switching to release mode?



  • @jsulm clean,run qmake,build
    "The plugin 'C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/mediaservice/wmfengined.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
    not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/m.senin/source/repos/QtTest/build-untitled-Qt5_13_2_msvc2017_64-Release/release/mediaservice" ...
    Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\dsengine.dll: The specified module could not be found.
    QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/mediaservice/dsengine.dll" : "Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\dsengine.dll: The specified module could not be found."
    Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\wmfengine.dll: The specified module could not be found.
    QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/mediaservice/wmfengine.dll" : "Cannot load library C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\plugins\mediaservice\wmfengine.dll: The specified module could not be found."
    QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.mediaplayer" : ("directshow")
    defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/m.senin/source/repos/QtTest/build-untitled-Qt5_13_2_msvc2017_64-Release/release/accessible" ...
    mincore\com\oleaut32\dispatch\ups.cpp(2125)\OLEAUT32.dll!00007FFF110B491B: (caller: 00007FFF110B4A92) ReturnHr(1) tid(64a8) 8002801D Library not registered.
    QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.mediaplayer" : ("directshow")
    QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.mediaplayer" : ("directshow")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/accessiblebridge" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/m.senin/source/repos/QtTest/build-untitled-Qt5_13_2_msvc2017_64-Release/release/accessiblebridge" ...
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/styles/qwindowsvistastyle.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qgif.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qicns.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qico.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qjpeg.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qsvg.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qtga.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qtiff.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qwbmp.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/imageformats/qwebp.dll"
    QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/plugins/platforms/qwindows.dll"



  • @architect23 , problem is SOLVED
    need install Windows_MediaFeaturePack_x64_1903_V1.exe


Log in to reply