Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Unified Diff: Source/core/html/shadow/MediaControls.cpp

Issue 204803002: Make scrubbing a MediaControls-internal concept (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: check mediaControllerInterface().paused() Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/MediaControls.cpp
diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp
index 59d1a761f8f057338027c3287128b302c6b96a4d..17efb600f9bd20ab826198f3ad3c1282c1341d4f 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -65,6 +65,7 @@ MediaControls::MediaControls(HTMLMediaElement& mediaElement)
, m_hideFullscreenControlsTimer(this, &MediaControls::hideFullscreenControlsTimerFired)
, m_isFullscreen(false)
, m_isMouseOverControls(false)
+ , m_isPausedForScrubbing(false)
{
}
@@ -176,7 +177,7 @@ void MediaControls::reset()
m_durationDisplay->setInnerText(RenderTheme::theme().formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
m_durationDisplay->setCurrentValue(duration);
- m_playButton->updateDisplayType();
+ updatePlayState();
updateCurrentTimeDisplay();
@@ -233,9 +234,7 @@ void MediaControls::playbackStarted()
m_currentTimeDisplay->show();
m_durationDisplay->hide();
- if (m_overlayPlayButton)
- m_overlayPlayButton->updateDisplayType();
- m_playButton->updateDisplayType();
+ updatePlayState();
m_timeline->setPosition(mediaControllerInterface().currentTime());
updateCurrentTimeDisplay();
@@ -254,9 +253,7 @@ void MediaControls::playbackProgressed()
void MediaControls::playbackStopped()
{
- if (m_overlayPlayButton)
- m_overlayPlayButton->updateDisplayType();
- m_playButton->updateDisplayType();
+ updatePlayState();
m_timeline->setPosition(mediaControllerInterface().currentTime());
updateCurrentTimeDisplay();
makeOpaque();
@@ -264,6 +261,33 @@ void MediaControls::playbackStopped()
stopHideFullscreenControlsTimer();
}
+void MediaControls::updatePlayState()
+{
+ if (m_isPausedForScrubbing)
+ return;
+
+ if (m_overlayPlayButton)
+ m_overlayPlayButton->updateDisplayType();
+ m_playButton->updateDisplayType();
+}
+
+void MediaControls::beginScrubbing()
+{
+ if (!mediaControllerInterface().paused()) {
+ m_isPausedForScrubbing = true;
+ mediaControllerInterface().pause();
+ }
+}
+
+void MediaControls::endScrubbing()
+{
+ if (m_isPausedForScrubbing) {
+ m_isPausedForScrubbing = false;
+ if (mediaControllerInterface().paused())
+ mediaControllerInterface().play();
+ }
+}
+
void MediaControls::updateCurrentTimeDisplay()
{
double now = mediaControllerInterface().currentTime();
« no previous file with comments | « Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698