Can't play sound.
-
Hello, I have problem with playing sound.I have code:
QMediaPlayer *player = new QMediaPlayer(this, QMediaPlayer::StreamPlayback); QUrl file = QUrl::fromLocalFile("C:/Users/Downloads/Telegram Desktop/123.mp3"); player->setMedia(file); player->setVolume(99); player->play();
But sound don't work. I make new compile: plugins.pro(new Qt5Multimediad.dll, new wmfengined.dll, new dsengined.dll) but I have message in my app:
Cannot load library C:\qt2\5.15.2\msvc2019_64\plugins\mediaservice\dsengined.dll: The specified module could not be found.
QLibraryPrivate::loadPlugin failed on "C:/qt2/5.15.2/msvc2019_64/plugins/mediaservice/dsengined.dll" : "Cannot load library C:\qt2\5.15.2\msvc2019_64\plugins\mediaservice\dsengined.dll: The specified module could not be found."
Cannot load library C:\qt2\5.15.2\msvc2019_64\plugins\mediaservice\wmfengined.dll: The specified module could not be found.
QLibraryPrivate::loadPlugin failed on "C:/qt2/5.15.2/msvc2019_64/plugins/mediaservice/wmfengined.dll" : "Cannot load library C:\qt2\5.15.2\msvc2019_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"
What is wrong? -
@architect23 said in Can't play sound.:
What is wrong?
Did you check whether those DLLs are there or not?
How did you install Qt?"I make new compile: plugins.pro(new Qt5Multimediad.dll, new wmfengined.dll, new dsengined.dll)" - what does "new" mean here? What did you change?
You should also add error handling to your app (https://doc.qt.io/qt-5/qmediaplayer.html#error-1).
-
1)Of course I checked exist dll in "C:\qt2\5.15.2\msvc2019_64\plugins\mediaservice"
2)I downloaded offline installer 5.15.2
3)I built new dll and reversed they in path "C:\qt2\5.15.2\msvc2019_64\plugins\mediaservice" -
-
@architect23 I still do not understand this: why do you think you need to built new DLLs?
-
@architect23 said in Can't play sound.:
because i saw, that my project did't see dlls
What do you mean with this?
To useQMediaPlayer
, you have to enable multimedia libraries in your project by addingQT += multimedia
in your PRO file. -
@KroMignon of course I did it:
QT += core gui multimedia