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

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

Issue 2047333002: Pause autoplay muted video when unmuting if there's no user gesture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autoplay-flag
Patch Set: Check isGestureNeeded when unmuting 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
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 441ee5b55a8b6e020d888087c1062bc553bea0e0..bf72ca0499e69b0bf99442d9f11d7ecc1269eeee 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -2260,6 +2260,9 @@ void HTMLMediaElement::setMuted(bool muted)
{
DVLOG(MEDIA_LOG_LEVEL) << "setMuted(" << (void*)this << ", " << boolString(muted) << ")";
+ if (UserGestureIndicator::processingUserGesture())
+ unlockUserGesture();
+
if (m_muted == muted)
return;
@@ -2274,6 +2277,10 @@ void HTMLMediaElement::setMuted(bool muted)
Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute_Off"));
scheduleEvent(EventTypeNames::volumechange);
+
+ // Pause the element when unmuting if there was no user gesture.
mlamouri (slow - plz ping) 2016/06/09 17:43:16 nit: s/if there was no user gesture./if the elemen
+ if (!muted && isGestureNeededForPlayback())
+ pause();
}
void HTMLMediaElement::updateVolume()

Powered by Google App Engine
This is Rietveld 408576698