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

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

Issue 2039773003: [Android] Added a runtime flag to enable autoplay of muted videos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « content/renderer/render_view_impl.cc ('k') | third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 7beecb9dd4be9a28665ac847fe9e6f45f67b085f..aac7685134bb6ec51f87fe7767f7907c6b686455 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -94,7 +94,7 @@
#include "wtf/text/CString.h"
#include <limits>
-#define MEDIA_LOG_LEVEL 3
+#define MEDIA_LOG_LEVEL 0
mlamouri (slow - plz ping) 2016/06/07 12:50:41 Did you mean to change this?
whywhat 2016/06/07 14:20:08 Reverted.
#ifndef LOG_MEDIA_EVENTS
// Default to not logging events because so many are generated they can overwhelm the rest of
@@ -2264,6 +2264,9 @@ void HTMLMediaElement::setMuted(bool muted)
Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute_Off"));
scheduleEvent(EventTypeNames::volumechange);
+
+ if (!UserGestureIndicator::processingUserGesture())
+ pause();
mlamouri (slow - plz ping) 2016/06/07 12:50:41 We should only have this behaviour for videos that
whywhat 2016/06/07 14:20:08 Removed.
}
void HTMLMediaElement::updateVolume()
@@ -3661,8 +3664,16 @@ void HTMLMediaElement::unlockUserGesture()
bool HTMLMediaElement::isGestureNeededForPlayback() const
{
- return m_lockedPendingUserGesture
- && !m_autoplayHelper->isGestureRequirementOverridden();
+ if (!m_lockedPendingUserGesture)
+ return false;
+
+ if (RuntimeEnabledFeatures::videosAsImagesEnabled() && muted())
+ return false;
mlamouri (slow - plz ping) 2016/06/07 12:50:41 I would leave this for another CL but you will nee
whywhat 2016/06/07 14:20:08 Ok.
+
+ if (m_autoplayHelper->isGestureRequirementOverridden())
+ return false;
+
+ return true;
}
void HTMLMediaElement::setNetworkState(NetworkState state)
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698