Results 1 to 3 of 3

Thread: QMediaPlayer Sound not working in other PCs

  1. #1
    Join Date
    Nov 2014
    Posts
    12
    Thanks
    4

    Default Re: QMediaPlayer Sound not working in other PCs

    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:
    Qt Code:
    1. QMediaPlayer * ErrorSound;
    To copy to clipboard, switch view to plain text mode 


    At cpp, in the constructer, I load the sounds:
    Qt Code:
    1. ErrorSound = new QMediaPlayer();
    2. ErrorSound->setMedia(QUrl("qrc:/Error.wav"));
    To copy to clipboard, switch view to plain text mode 

    Further in the correct place I call it to play:
    Qt Code:
    1. ErrorSound->play();
    To copy to clipboard, switch view to plain text mode 

    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.

    Qt Code:
    1. mFilename = mDir.absolutePath();
    2. ErrorSound->setMedia(QUrl(mFilename + QLatin1Char('/') + "Error.wav"));
    3. ErrorSound->play();
    To copy to clipboard, switch view to plain text mode 

    The sound stills work in the compiled PC and not in others. What's the secret?

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: QMediaPlayer Sound not working in other PCs

    Have you distributed the necessary plugins with your application and are they installed where Qt looks for them?

    http://qt-project.org/doc/qt-4.8/dep...t-plugins.html or
    https://doc-snapshots.qt.io/qt5-5.4/...tml#qt-plugins

    depending on your Qt version.

    Edit: I don't develop on Windows, but the windeployqt tool looks like it might help ensure you have packaged all of the required plugins with your application. I develop on Mac and the macdeployqt tool is invaluable.

    Hope that helps.

  3. The following user says thank you to jefftee for this useful post:

    digimonkey (13th March 2015)

  4. #3
    Join Date
    Nov 2014
    Posts
    12
    Thanks
    4

    Default Re: QMediaPlayer Sound not working in other PCs

    Thank you!

    Windeployqt is just great, didnt knew about it.

    All working now

Similar Threads

  1. QMediaplayer Sound file problem
    By digimonkey in forum Newbie
    Replies: 1
    Last Post: 4th February 2018, 06:33
  2. Get QAudioBuffer from QMediaPLayer
    By azazaz in forum Qt Programming
    Replies: 2
    Last Post: 18th February 2014, 05:10
  3. Playing MP4 and FLV with QMediaPlayer
    By JasonKretzer in forum Newbie
    Replies: 2
    Last Post: 12th September 2013, 21:58
  4. QMediaPlayer repeat sound
    By alenn.masic in forum Qt Programming
    Replies: 0
    Last Post: 21st February 2013, 14:46
  5. MP3 Sound / OGG Sound Play on GUI
    By patrik08 in forum Newbie
    Replies: 3
    Last Post: 1st September 2006, 19:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.