[Android-development] playing sound on Qt/Android

maitai at virtual-winds.org maitai at virtual-winds.org
Wed Nov 26 12:09:08 CET 2014


Thanks for your reply.

In fact I made further tests... and discover that the problem is with 
.wav files. If I select an mp3 it works perfectly on Android, but not 
with a wav file. If I use a QSoundEffect object to play the same wav 
file, it plays on Android. On windows, QMediaPlayer is able to play both 
formats.

Is this a known issue? I uploaded the small wav file i'm using here: 
http://www.virtual-winds.org/maitai/horn.zip

My code is very simple, since I am just testing for the time being:

     QMediaPlayer *testPlayer = new QMediaPlayer(this);
     
testPlayer->setMedia(QUrl::fromLocalFile(appFolder.value("userFiles") + 
"boat_horn.wav"));
     testPlayer->setVolume(99);
     testPlayer->play();
     return;




More information about the Android-development mailing list