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

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

Issue 576073005: Implement "potentially playing" for media elements per spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 10 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') | no next file » | 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 873298fe8ed0e570630e8a8456f86c8aa3b83193..0a38e3928a3df31ae88e9730f48396c1b913ae0a 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -336,7 +336,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
, m_defaultPlaybackRate(1.0f)
, m_networkState(NETWORK_EMPTY)
, m_readyState(HAVE_NOTHING)
- , m_readyStateMaximum(HAVE_NOTHING)
, m_volume(1.0f)
, m_lastSeekTime(0)
, m_previousProgressTime(std::numeric_limits<double>::max())
@@ -796,7 +795,6 @@ void HTMLMediaElement::prepareForLoad()
// 4.4 - If readyState is not set to HAVE_NOTHING, then set it to that state.
m_readyState = HAVE_NOTHING;
- m_readyStateMaximum = HAVE_NOTHING;
// 4.5 - If the paused attribute is false, then set it to true.
m_paused = true;
@@ -1802,9 +1800,6 @@ void HTMLMediaElement::setReadyState(ReadyState state)
m_readyState = HAVE_CURRENT_DATA;
}
- if (oldState > m_readyStateMaximum)
- m_readyStateMaximum = oldState;
-
if (m_networkState == NETWORK_EMPTY)
return;
@@ -3382,11 +3377,27 @@ PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::seekable() const
bool HTMLMediaElement::potentiallyPlaying() const
{
- // "pausedToBuffer" means the media engine's rate is 0, but only because it had to stop playing
- // when it ran out of buffered data. A movie is this state is "potentially playing", modulo the
- // checks in couldPlayIfEnoughData().
- bool pausedToBuffer = m_readyStateMaximum >= HAVE_FUTURE_DATA && m_readyState < HAVE_FUTURE_DATA;
- return (pausedToBuffer || m_readyState >= HAVE_FUTURE_DATA) && couldPlayIfEnoughData() && !isBlockedOnMediaController();
+ // A media element is said to be potentially playing when its paused attribute is false, the
+ // element has not ended playback, playback has not stopped due to errors, the element either
+ // has no current media controller or has a current media controller but is not blocked on its
+ // media controller, and the element is not a blocked media element.
+
+ if (paused())
+ return false;
+
+ if (endedPlayback())
+ return false;
+
+ if (stoppedDueToErrors())
+ return false;
+
+ if (isBlockedOnMediaController())
+ return false;
+
+ if (isBlocked())
+ return false;
+
+ return true;
}
bool HTMLMediaElement::couldPlayIfEnoughData() const
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698