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

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

Issue 2052623002: [Android, Media] Enable autoplay settings for muted autoplay, wired them up to the media element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-settings-npe
Patch Set: Rebased, added a test 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 | « third_party/WebKit/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: 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 331a06c88bcee6e3001349418be3edf341f982c6..ed596d00d9df66b3052914fec0e6c9c47b0352e2 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -3709,8 +3709,11 @@ bool HTMLMediaElement::isGestureNeededForPlayback() const
// We want to allow muted video to autoplay if:
// - the flag is enabled;
// - Data Saver is not enabled;
- if (muted() && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()
- && !(document().settings() && document().settings()->dataSaverEnabled())) {
+ // - Autoplay is enabled in settings;
+ if (muted()
+ && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()
+ && !(document().settings() && document().settings()->dataSaverEnabled())
+ && isAutoplayAllowedPerSettings()) {
return false;
}
@@ -3720,6 +3723,15 @@ bool HTMLMediaElement::isGestureNeededForPlayback() const
return true;
}
+bool HTMLMediaElement::isAutoplayAllowedPerSettings() const
+{
+ LocalFrame* frame = document().frame();
+ if (!frame)
+ return false;
+ FrameLoaderClient* frameLoaderClient = frame->loader().client();
+ return frameLoaderClient && frameLoaderClient->allowAutoplay(false);
+}
+
void HTMLMediaElement::setNetworkState(NetworkState state)
{
if (m_networkState != state) {
@@ -3959,11 +3971,7 @@ String HTMLMediaElement::AutoplayHelperClientImpl::autoplayExperimentMode() cons
bool HTMLMediaElement::AutoplayHelperClientImpl::isAutoplayAllowedPerSettings() const
{
- LocalFrame* frame = m_element->document().frame();
- if (!frame)
- return false;
- FrameLoaderClient* frameLoaderClient = frame->loader().client();
- return frameLoaderClient && frameLoaderClient->allowAutoplay(false);
+ return m_element->isAutoplayAllowedPerSettings();
}
void HTMLMediaElement::AutoplayHelperClientImpl::setRequestPositionUpdates(bool request)
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698