Results 1 to 3 of 3

Thread: looping problem in phonon audio player

  1. #1
    Join Date
    May 2011
    Posts
    120
    Thanks
    33
    Qt products
    Qt4
    Platforms
    Windows

    Default looping problem in phonon audio player

    song is set as static in phonon audio player. loop works using aboutToFinish().the problem is that there is 1 sec delay at the end of the song, the the song repeats.
    how can we avoid the delay?
    Qt Code:
    1. musicpath="sound/sample.mp3";
    2. Phonon::AudioOutput *audioOutput;
    3. Phonon::VolumeSlider *volumeSlider;
    4.  
    5. Phonon::MediaObject *mediaObject;
    6. mediaObject = new Phonon::MediaObject(this);
    7. mediaObject->setCurrentSource(Phonon::MediaSource( musicpath));
    8. Phonon::createPath(mediaObject, audioOutput);
    9. volumeSlider->setAudioOutput(audioOutput);
    10. mediaObject->setCurrentSource(Phonon::MediaSource( musicpath));
    11.  
    12. mediaObject->play();
    13. ui->play->hide();
    14. ui->pause->show();
    15. connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish1()));
    16.  
    17.  
    18. void MainWindow::aboutToFinish1()
    19.  
    20. {
    21.  
    22. mediaObject->stop();
    23. mediaObject->play();
    24. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Aug 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: looping problem in phonon audio player

    Quote Originally Posted by vinayaka View Post
    song is set as static in phonon audio player. loop works using aboutToFinish().the problem is that there is 1 sec delay at the end of the song, the the song repeats.
    how can we avoid the delay?
    Qt Code:
    1. musicpath="sound/sample.mp3";
    2. Phonon::AudioOutput *audioOutput;
    3. Phonon::VolumeSlider *volumeSlider;
    4.  
    5. Phonon::MediaObject *mediaObject;
    6. mediaObject = new Phonon::MediaObject(this);
    7. mediaObject->setCurrentSource(Phonon::MediaSource( musicpath));
    8. Phonon::createPath(mediaObject, audioOutput);
    9. volumeSlider->setAudioOutput(audioOutput);
    10. mediaObject->setCurrentSource(Phonon::MediaSource( musicpath));
    11.  
    12. mediaObject->play();
    13. ui->play->hide();
    14. ui->pause->show();
    15. connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish1()));
    16.  
    17.  
    18. void MainWindow::aboutToFinish1()
    19.  
    20. {
    21.  
    22. mediaObject->stop();
    23. mediaObject->play();
    24. }
    To copy to clipboard, switch view to plain text mode 
    hello, you test this ?

    why i cannot run it !~

  3. #3
    Join Date
    Dec 2008
    Location
    France
    Posts
    93
    Thanked 23 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: looping problem in phonon audio player

    Have you check the transitionTime property?
    I use enqueue ( const MediaSource & source ) when aboutToFinish() appears and it works fine (no latency at all). Your method with stop & start seems not working for me (the song is not played at the second time). However I'm not on a Windows computer, maybe it can explain those differents observations.

Similar Threads

  1. Phonon - audio-output-problem and high latency
    By nearlyNERD in forum Qt Programming
    Replies: 3
    Last Post: 27th June 2012, 21:17
  2. Replies: 4
    Last Post: 28th December 2010, 04:13
  3. Phonon - Audio-Output-Problem
    By nearlyNERD in forum Newbie
    Replies: 4
    Last Post: 19th July 2010, 10:52
  4. Phonon Video Player Problem...
    By emrez in forum Qt Programming
    Replies: 0
    Last Post: 14th July 2010, 14:26
  5. problem with phonon/music player example.
    By rishiraj in forum Newbie
    Replies: 9
    Last Post: 23rd January 2009, 08:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.