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

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 247083003: Revert "Make scrubbing a MediaControls-internal concept" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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/HTMLMediaElement.h ('k') | Source/core/html/MediaController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index e3552279e73c85d31676bb58f87f3071accbc726..71f7cd42d6c3c4502ab4bc5fc5b20eb5d844cf59 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -2138,6 +2138,33 @@ void HTMLMediaElement::setMuted(bool muted)
scheduleEvent(EventTypeNames::volumechange);
}
+void HTMLMediaElement::beginScrubbing()
+{
+ WTF_LOG(Media, "HTMLMediaElement::beginScrubbing - paused() is %s", boolString(paused()));
+
+ if (!paused()) {
+ if (ended()) {
+ // Because a media element stays in non-paused state when it reaches end, playback resumes
+ // when the slider is dragged from the end to another position unless we pause first. Do
+ // a "hard pause" so an event is generated, since we want to stay paused after scrubbing finishes.
+ pause();
+ } else {
+ // Not at the end but we still want to pause playback so the media engine doesn't try to
+ // continue playing during scrubbing. Pause without generating an event as we will
+ // unpause after scrubbing finishes.
+ setPausedInternal(true);
+ }
+ }
+}
+
+void HTMLMediaElement::endScrubbing()
+{
+ WTF_LOG(Media, "HTMLMediaElement::endScrubbing - m_pausedInternal is %s", boolString(m_pausedInternal));
+
+ if (m_pausedInternal)
+ setPausedInternal(false);
+}
+
// The spec says to fire periodic timeupdate events (those sent while playing) every
// "15 to 250ms", we choose the slowest frequency
static const double maxTimeupdateEventFrequency = 0.25;
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/MediaController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698