tags:

views:

1065

answers:

2

Is there a way to play mp3s in Qt 4.5?

Thanks!

+4  A: 

Phonon library from KDE has been included already in 4.4 release of QT.

I think there's even some sample code that ships with qt that shows how to utilize phonon to play mp3 files (and more).

Documentation here: http://doc.qtsoftware.com/4.5/phonon-module.html

Phonon homepage: http://phonon.kde.org/

rasjani
Great -- URLs please?
Alex Martelli
url for documentation added. QT ships with phonon (enabled/disabled at build-time) so the examples can be viewed on your local machine if you have the source distribution.
rasjani
great, I'm dropping my answer -- incorrect even though it quoted trolltech's docs verbatim!-) Tx, this will be useful.
Alex Martelli
+2  A: 

example from Qt Assistant

QT += phonon

 Phonon::MediaObject *music =
     Phonon::createPlayer(Phonon::MusicCategory,
                          Phonon::MediaSource("/path/mysong.mp3"));
 music->play();

works perfectly.

anton