PDA

View Full Version : phonon seek does not work as i want?



mismael85
15th December 2009, 10:05
hello every body.
i am using phonon to play sound file but i want the sound file to start from a specified position so i used the following code

m_player = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(aSoundFile));
m_player->play();
m_player-seek();

but it does not work it starts from the beginning of the file
how can i play the sound file from the specified position?

yvan
30th January 2010, 21:30
Hello,

I see that a mediaobject can emit a signal MediaObject::seekableChanged ( bool isSeekable ) when the state of the seeking property has changed.
Maybe you could try to wait for this signal before using the seek() method, or use isSeekable() to check the state before seeking.

bye

CiprianManea
16th February 2011, 07:59
Hello,

I see that a mediaobject can emit a signal MediaObject::seekableChanged ( bool isSeekable ) when the state of the seeking property has changed.
Maybe you could try to wait for this signal before using the seek() method, or use isSeekable() to check the state before seeking.

bye

Hello I am trying the same thing as mismael85. I have tried what yvan sad, but with no luck.
In QT doc is stated: You can only seek if state() is PlayingState, BufferingState or PausedState.
So I tested the state() of my mediaObject, and when is in PlayingState, the isSeekable() method returns false, and my program never enters in my SLOT connected to the signal seekableChanged!
What am I doing wrong, here?

Zed
16th February 2011, 10:10
m_player = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(aSoundFile));
m_player->play();
m_player-seek();


Hi, try this:
m_player->seek(0);
m_player->play();