PDA

View Full Version : How to play an audio file in the symbian device?



satya@sipl
18th July 2012, 14:16
Hello every one.

I have written some code to play an audio(.mp3) for my Symbian device.
I'm using two methods for the above reason.

First method
I'm using QMediaPlayer for this purpose.


player = new QMediaPlayer;

player->setMedia(QUrl::fromLocalFile("D:/proj/Resources/song/GN.mp3"));

player->setVolume(100);

player->play();


Here it is only playing the audio on the simulator. But on device it is not working. I think the path has some problem. I do not know how to solve it.


Second method


player = new QMediaPlayer;

QString dir,fileName;

fileName =QFileDialog::getOpenFileName(this, tr("Open all file"), dir, "*");

player->setMedia(QUrl(fileName));

player->play();


Here also it is working fine in simulator, but not on device. Here I do not know the exact problem.

Please help me to find a solution to this problem.

Thanks to all in advance.

sonulohani
19th July 2012, 07:45
Use Phonon (qt-project.org/doc/qt-4.8/phonon-module.html)instead.