From d34bbd852241fcd9ddf50c961b5e234f9de0b5ac Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 29 Sep 2009 14:26:58 +0100 Subject: Fixed seek during video playback --- src/3rdparty/phonon/mmf/TODO.txt | 3 --- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 14 +++++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/phonon/mmf/TODO.txt b/src/3rdparty/phonon/mmf/TODO.txt index ba15897..a2b1865 100644 --- a/src/3rdparty/phonon/mmf/TODO.txt +++ b/src/3rdparty/phonon/mmf/TODO.txt @@ -3,9 +3,6 @@ TODO list for MMF Phonon backend The following items are in rough order of priority. -* Seeking does not work for video playback -Do we need to pause/stop the CVideoPlayerUtility before calling SetPositionL? This is inconsistent with CMdaAudioPlayerUtility, but may be necessary - needs to be tested on target. - * Activating full-screen video playback in qmediaplayer causes the app to crash This may be symptomatic of more general problems with re-sizing / re-positioning video while playing. diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index 8a38b76..64e6568 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -147,10 +147,22 @@ void MMF::VideoPlayer::doStop() void MMF::VideoPlayer::doSeek(qint64 ms) { TRACE_CONTEXT(VideoPlayer::doSeek, EVideoApi); + + bool wasPlaying = false; + if(state() == PlayingState) { + // The call to SetPositionL does not have any effect if playback is + // ongoing, so we pause before seeking. + doPause(); + wasPlaying = true; + } TRAPD(err, m_player->SetPositionL(TTimeIntervalMicroSeconds(ms * 1000))); - if (KErrNone != err) { + if(KErrNone == err) { + if(wasPlaying) + doPlay(); + } + else { TRACE("SetPositionL error %d", err); setError(NormalError); } -- cgit v0.12