diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2009-12-02 16:11:29 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2009-12-08 13:07:19 (GMT) |
commit | 946dede337f0a43ccb394c10aa2045bc9ef59301 (patch) | |
tree | e45b4657ff1775a0e125a0d9ed677ed908e0b351 /demos | |
parent | 66b765734585971dd9d248059701fdecebbccd78 (diff) | |
download | Qt-946dede337f0a43ccb394c10aa2045bc9ef59301.zip Qt-946dede337f0a43ccb394c10aa2045bc9ef59301.tar.gz Qt-946dede337f0a43ccb394c10aa2045bc9ef59301.tar.bz2 |
Mediaplayer: enqueue all entries from .ram file before starting playback
This ensures that Phonon::MediaObject::setNextSource is called before
the first clip finishes playback, and therefore that the next clip
is played once the first finishes.
Reviewed-by: Frans Englich
Diffstat (limited to 'demos')
-rw-r--r-- | demos/qmediaplayer/mediaplayer.cpp | 16 | ||||
-rw-r--r-- | demos/qmediaplayer/mediaplayer.h | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 8f6848f..8471ebd 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -673,6 +673,13 @@ void MediaPlayer::setFile(const QString &fileName) m_MediaObject.play(); } +void MediaPlayer::setLocation(const QString& location) +{ + setWindowTitle(location.right(location.length() - location.lastIndexOf('/') - 1)); + m_MediaObject.setCurrentSource(Phonon::MediaSource(QUrl::fromEncoded(location.toUtf8()))); + m_MediaObject.play(); +} + bool MediaPlayer::playPauseForDialog() { // If we're running on a small screen, we want to pause the video when @@ -850,9 +857,7 @@ void MediaPlayer::openUrl() bool ok = false; sourceURL = QInputDialog::getText(this, tr("Open Location"), tr("Please enter a valid address here:"), QLineEdit::Normal, sourceURL, &ok); if (ok && !sourceURL.isEmpty()) { - setWindowTitle(sourceURL.right(sourceURL.length() - sourceURL.lastIndexOf('/') - 1)); - m_MediaObject.setCurrentSource(Phonon::MediaSource(QUrl::fromEncoded(sourceURL.toUtf8()))); - m_MediaObject.play(); + setLocation(sourceURL); settings.setValue("location", sourceURL); } } @@ -892,10 +897,11 @@ void MediaPlayer::openRamFile() } if (!list.isEmpty()) { - m_MediaObject.setCurrentSource(Phonon::MediaSource(list[0])); - m_MediaObject.play(); + m_MediaObject.clearQueue(); + setLocation(list[0].toString()); for (int i = 1; i < list.count(); i++) m_MediaObject.enqueue(Phonon::MediaSource(list[i])); + m_MediaObject.play(); } forwardButton->setEnabled(!m_MediaObject.queue().isEmpty()); diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h index 14ed4ac..fc1bd90 100644 --- a/demos/qmediaplayer/mediaplayer.h +++ b/demos/qmediaplayer/mediaplayer.h @@ -112,6 +112,7 @@ public: void dropEvent(QDropEvent *e); void handleDrop(QDropEvent *e); void setFile(const QString &text); + void setLocation(const QString &location); void initVideoWindow(); void initSettingsDialog(); |