0

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?

Saravanan
  • 131
  • 2
  • 13

4 Answers4

1

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
J. Chomel
  • 8,193
  • 15
  • 41
  • 69
  • things are NOT so bright: https://forum.qt.io/topic/127649/mp3-not-being-played-on-android/13 – Vega4 Jun 18 '21 at 09:12
0

Stumblend in this one while searching info, this looks useful: http://qt-project.org/doc/qt-5/qml-qtmultimedia-mediaplayer.html

tru7
  • 6,348
  • 5
  • 35
  • 59
0

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

Vega4
  • 969
  • 1
  • 11
  • 25
0

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();