[Qt-interest] Looping Videos in QtMobility-1.0tp with QMediaPlayer?

Josiah Bryan jbryan at productiveconcepts.com
Wed Mar 3 05:12:36 CET 2010


Hey All -

I've been playing with the QtMobility 1.0 (TP) - the API looks 
fantastically useful! I'm quite excited about the possibilities.

One key piece of functionality that I can't quite seem to figure out, 
but I would heavy use of, is *looping* a video - e.g. to use as a 
background beneath a presentation.

In my test program, I setup a QMediaPlayer and QVideoWidget like this:

player = new QMediaPlayer(this);
connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
        this, SLOT(statusChanged(QMediaPlayer::MediaStatus)));
videoWidget = new QVideoWidget;
videoWidget->setMediaObject(player);
media = QUrl::fromLocalFile("/data/video/loops/082_JumpBack.mov");
player->setMedia(media);
player->play();

...and in my statusChanged(QMediaPlayer::MediaStatus) slot, when I get 
the EndOfMedia status, I've tried:

player->setPosition(0); // does nothing by itself
---
player->setPosition(0); player->play(); // no change in video - still 
stopped
---
player->setMedia(media); player->play(); // starts again from the 
beginning, but with a 100ms-200ms black frame 'flash'
---
player->stop(); player->play(); // same thing - video goes black, then 
resumes playback

Bottom line - I can't get it to cleanly loop the video - any ideas? 
(Yes, the videos I'm using are specifically designed to be looped - last 
frame lines up visually with the first frame - no black frames or gaps.)

Oh, and if this is the wrong list for QtMobility1.0/tp - I'll gladly 
move this post somewhere else. Thanks!

-Josiah






More information about the Qt-interest-old mailing list