Playing sound file in mobile using QT
I am just trying to play a sound file in my mobile application using QMediaPlayer.
I have included the sound file in my project using Qt Resource file.
While executing mediaplayer state changes to loading & then directly to invalid media.
I have tried midi,mp3 and wave files.
My code is like this:
player = new QMediaPlayer(this);
connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(statusChanged(QMediaPlayer::MediaStatus)));
void playSound::statusChanged(QMediaPlayer::MediaStatus status)
qDebug() <<"In status changed "<<status;
qDebug() <<"media loaded ";
qDebug() <<"Invadid media ";
Please help me to play a sound in handset from a file.
Thanks in advance!!!
[EDIT: code formatting, Volker]
I think it's a known issue that Qt Multimedia classes can't play from Qt resources (at least on Symbian). You need to deploy the file separately from your application rather than having it compiled in, then use QUrl::fromLocalFile().
The most active community for Symbian development with Qt is on the Forum Nokia discussion boards - this kind of question would probably get answered in less than an hour. :-)