PDA

View Full Version : how to play song in the device ?



kumari arpita
2nd August 2012, 07:06
Hi,

I tried to play mp3 in my application its playing successfully in my simulator. I have added my mp3 in my resource folder. but in the device its not finding the path to play .

So kindly help in this what i need to change in my code.




player = new QMediaPlayer;

player->setMedia(QUrl::fromLocalFile("./IQRAV1/song/GN.mp3"));
player->setVolume(100);

player->play();





Thanks and Regards,
Arpita

sonulohani
2nd August 2012, 10:00
Use Phonon instead. It is much better.

spirit
2nd August 2012, 10:19
no it's not. and if I'm not mistaken it's dropped in Qt 5.

sonulohani
2nd August 2012, 11:19
Read the documentation of qt5. http://qt-project.org/doc/qt-5.0/phonon.html

spirit
2nd August 2012, 11:37
Phonon
Overall module state: Done inside Qt, Maintained outside of Qt
Reasoning: QtMultimediaKit recommended instead; development of Phonon continues and is maintained outside of Qt, by the KDE community.
(http://qt-project.org/wiki/Qt_Modules_Maturity_Level).

Gokulnathvc
24th July 2013, 12:17
Use
Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory,
Phonon::MediaSource(":\song.mp3"));
music->play();

add #include "MediaObject"