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

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: Addressed comments 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/LayoutTests/media/autoplay-muted.html ('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 7079ba7e9dfd636e082a54d1122e4ceb27400671..331a06c88bcee6e3001349418be3edf341f982c6 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -2283,6 +2283,9 @@ void HTMLMediaElement::setMuted(bool muted)
{
DVLOG(MEDIA_LOG_LEVEL) << "setMuted(" << (void*)this << ", " << boolString(muted) << ")";
+ if (UserGestureIndicator::processingUserGesture())
+ unlockUserGesture();
+
if (m_muted == muted)
return;
@@ -2297,6 +2300,10 @@ void HTMLMediaElement::setMuted(bool muted)
Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute_Off"));
scheduleEvent(EventTypeNames::volumechange);
+
+ // Pause the element when unmuting if it's still locked.
+ if (!muted && isGestureNeededForPlayback())
+ pause();
}
void HTMLMediaElement::updateVolume()
« no previous file with comments | « third_party/WebKit/LayoutTests/media/autoplay-muted.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698