Reputation: 131
i developed my application in QT, i am trying to port for android. my application working fine in android with few issues. the main issue is, i am not able to play the audio file when i am trying to put the audio file play Code i am getting error
QSound::play(FilePath);
Error: : -1: error: error: cannot find -lQtMultimediaKit D:\Projects\test\demo.cpp:996: error: undefined reference to 'QSound::play(QString const&)'
my config: QT 4.8,QT Creator 2.5.83 and necessitas and windows XP
i am able to include the QSound Header file and using intellisense to type the QSound::Play no issue while typing when i am getting error on compilation. so i tried to look into the source folder and i found QSound.h header also.
How to play the Audio file in Android using QT?
Upvotes: 0
Views: 2418
Reputation: 1
this works for me
file .pro
QTPLUGIN += qtaudio_coreaudio
QT += androidextras
QT += widgets
QT += quickcontrols2
file in Resources:
player2->setMedia(QUrl("qrc:/new/prefix1/folder_x/file.mp3"));
player2->play();
Upvotes: 0
Reputation: 979
While the support of Audio for Android in QT is there, it's a journey through hell with the current release. If you want it stable in the end you'll end-up searching for external libraries anyway Take a look here
Upvotes: 0
Reputation: 9
in may case it works properly with no errors my code:
player->setMedia(QUrl("qrc:/new/prefix1/1.mp3"));
// ok it works on windows
//also works on android
Upvotes: 1
Reputation: 7222
Stumblend in this one while searching info, this looks useful: http://qt-project.org/doc/qt-5/qml-qtmultimedia-mediaplayer.html
Upvotes: 0