[Qt-interest] Looping Videos in QtMobility-1.0tp with QMediaPlayer?
dmytro.poplavskiy at nokia.com
dmytro.poplavskiy at nokia.com
Wed Mar 3 08:11:27 CET 2010
Hi Josiah,
On 03/03/2010, at 2:12 PM, ext Josiah Bryan wrote:
> 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.
One way to achieve this is to use QMediaPlaylist with
one of loop playback modes (CurrentItemInLoop or Loop).
If the playback backend supports intrinsic playlist,
it may use this information to preload the next item
or just not to stop the current one.
In the worst case, if playback backend doesn't provide
playlists functions, QMediaPlaylist will use internal local memory playlist
to achieve the similar behaviour ( but with possible gaps, like you currently have ).
>
> 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:
I think just player->play() should be enough,
it's a bug in the current backend implementation.
Btw what OS are you using?
>
> 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
>
Regards
Dmytro.
More information about the Qt-interest-old
mailing list