Playing mp3 in a loop using Phonon
-
I never use Phonon module in qt before. But now I have task to play mp3 file in infinite loop, till someone(I mean some Event, signal etc) stop it. I write the following code to play once:
@m_mediaObject = new Phonon::MediaObject(this);
m_audioOutput = new Phonon::AudioOutput(Phonon::NotificationCategory, this);
m_audioOutput->setVolume(0.5);Phonon::createPath(m_mediaObject, m_audioOutput);
m_mediaObject->setCurrentSource(QString(":/Operator/Data/ring.mp3"));
m_mediaObject->play();@I can make signal-slot connection with some end-file signal and start to play file again but is there any Phonon native solution ?
-
I made the following : @ connect(m_mediaObject, SIGNAL(aboutToFinish()), this, SLOT(loopPlaying()));@
and slot looks like this:
@m_mediaObject->enqueue(Phonon::MediaSource(QString(":/Operator/Data/ring.mp3")));@
Slots entered but nothing happens. If i replace enqueue by setCurentSource and Play all works but previous playing session don't reach it's end and interrupt. When I replace aboutToFinish signal by finished signal it even don't enters the slot. -
I tried to execute this code on another PC and it's work as I planing. It plays in a loop. But on my PC it plays only one time. All my PC and other use Windows XP Sp3 but I installed K-Lite codec pack on my PC.