Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to play mp3s in Qt 4.5?

Tags:

audio

qt4

mp3

Is there a way to play mp3s in Qt 4.5?

Thanks!

like image 523
Roger B Avatar asked Jun 14 '09 18:06

Roger B


2 Answers

example from Qt Assistant

QT += phonon

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

works perfectly.

like image 133
anton Avatar answered Nov 16 '22 06:11

anton


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/

like image 27
rasjani Avatar answered Nov 16 '22 06:11

rasjani