QT Phonon Tick Slot not triggering, please help.



  • Hello Everybody,

    I have a problem with using Phonon inside QT. I am trying to connect the tick signal to a tick slot. But when a media file is playing.. the tick slot is never called. This very simple example doesn't work. I see in my output window from the debug call that the Player is started, also i hear the musicl. But i dont see the tick slot getting triggered. What am i doing wrong??

    Please help.

    Best Regards,

    Bastiaan

    Here is my header (musicplayer.h)

    @#include <QMainWindow>
    #include <phonon/audiooutput.h>
    #include <phonon/seekslider.h>
    #include <phonon/mediaobject.h>
    #include <phonon/volumeslider.h>
    #include <phonon/backendcapabilities.h>
    #include <QList>

    class QTime;

    class musicplayer : public QObject
    {
    Q_OBJECT

    public:
    explicit musicplayer(QObject *parent = 0);

    void Init();
    

    private slots:
    void tick(qint64 iTime);

    };

    #endif // MUSICPLAYER_H@

    Here is my class (musicplayer.c)

    @#include "musicplayer.h"
    #include <QtDebug>

    musicplayer::musicplayer(QObject *parent) : QObject(parent)
    {
    }

    void musicplayer::Init()
    {
    Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource("test.mp3"));

    mediaObject->setTickInterval(500);
    connect(mediaObject, SIGNAL(tick(qint64)),this, SLOT(tick(qint64)));
    
    mediaObject->play();
    
    qDebug() << "Player started";
    

    }

    void musicplayer::tick(qint64 iTime)
    {
    qDebug() << iTime;
    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.