digimonkey
13th March 2015, 04:29
Hello,
I have a problem with QMediaPlayer play sound in a different PC than in the developed one.
The release program works just fine in the PC that I have developed (I've copied all *.dll,...), but trying to use the same program in a different PC there is no sound.
I have my sounds in my Resources and their are together with the images that I use, so it isn't path fail.
I create in the header (*.h) file my QMediaPlayer variable:
QMediaPlayer * ErrorSound;
At cpp, in the constructer, I load the sounds:
ErrorSound = new QMediaPlayer();
ErrorSound->setMedia(QUrl("qrc:/Error.wav"));
Further in the correct place I call it to play:
ErrorSound->play();
I've checked the Data.qrc (my resource file) and all files are there:
<RCC>
<qresource prefix="/">
.......other files
<file>Error.wav</file>
</qresource>
</RCC>
All image files and sound files are in same place, same folder, as the *.exe file.
If anyone got this problem and know how to fix it i would thank you for helping me out.
## UPDATE ##
I've tried a new thing, that is load the current path and load directly the sound, instead using it as resource.
mFilename = mDir.absolutePath();
ErrorSound->setMedia(QUrl(mFilename + QLatin1Char('/') + "Error.wav"));
ErrorSound->play();
The sound stills work in the compiled PC and not in others. What's the secret?
I have a problem with QMediaPlayer play sound in a different PC than in the developed one.
The release program works just fine in the PC that I have developed (I've copied all *.dll,...), but trying to use the same program in a different PC there is no sound.
I have my sounds in my Resources and their are together with the images that I use, so it isn't path fail.
I create in the header (*.h) file my QMediaPlayer variable:
QMediaPlayer * ErrorSound;
At cpp, in the constructer, I load the sounds:
ErrorSound = new QMediaPlayer();
ErrorSound->setMedia(QUrl("qrc:/Error.wav"));
Further in the correct place I call it to play:
ErrorSound->play();
I've checked the Data.qrc (my resource file) and all files are there:
<RCC>
<qresource prefix="/">
.......other files
<file>Error.wav</file>
</qresource>
</RCC>
All image files and sound files are in same place, same folder, as the *.exe file.
If anyone got this problem and know how to fix it i would thank you for helping me out.
## UPDATE ##
I've tried a new thing, that is load the current path and load directly the sound, instead using it as resource.
mFilename = mDir.absolutePath();
ErrorSound->setMedia(QUrl(mFilename + QLatin1Char('/') + "Error.wav"));
ErrorSound->play();
The sound stills work in the compiled PC and not in others. What's the secret?