summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Cape <dcape@qnx.com>2016-06-29 12:13:01 -0400
committerDan Cape <dcape@qnx.com>2016-07-04 14:01:51 +0000
commitfa91fc211c788305de930d355c1c81725f829789 (patch)
treee14017eb90ca3d93c5dc69a94dd6be708743b518
parentefccadf055dee97dae0a985c0680ff55acc5fbd7 (diff)
downloadqtmultimedia-fa91fc211c788305de930d355c1c81725f829789.tar.gz
QNX: Reset playback position before stopping media
This change ensures that the next media file to be played back will start playing at position 0. Without this change, it would start playback at the last position of the previous media file. In the play() function, when attempting to play a video, we first go into the loading state which just defers playing until later. Since we set the state to “Playing”, we now accept events from mm-renderer. It sends us a position update which ends up being from the previous video. Since we’re in “Playing” state, we trust this event is right and set our internal m_position variable to that value. Once the media has loaded, play() is called again and then we hit the call setPositionInternal() which seeks the media to our internal m_position (the position we got from mm-renderer). To resolve this, we now will call setPosition in the stop function that will cause mm-renderer to seek to 0 just before it stops playback (as recommended in documentation) so that any events we get from mm-renderer when we move to the “Playing” state will be related to the current media. Change-Id: I8ae35e57dd690bbae1fb996c1feb15ee4addab55 Reviewed-by: James McDonnell <jmcdonnell@qnx.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
-rw-r--r--src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp
index 1cccbfa01..569070a6a 100644
--- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp
+++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp
@@ -340,6 +340,8 @@ void MmRendererMediaPlayerControl::setState(QMediaPlayer::State state)
void MmRendererMediaPlayerControl::stopInternal(StopCommand stopCommand)
{
+ setPosition(0);
+
if (m_state != QMediaPlayer::StoppedState) {
if (stopCommand == StopMmRenderer) {
@@ -349,11 +351,6 @@ void MmRendererMediaPlayerControl::stopInternal(StopCommand stopCommand)
setState(QMediaPlayer::StoppedState);
}
-
- if (m_position != 0) {
- m_position = 0;
- emit positionChanged(0);
- }
}
void MmRendererMediaPlayerControl::setVolume(int volume)