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

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

Issue 2253683004: Cancel autoplay muted when visible if the video gets unmuted before being visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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-unmute-offscreen.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 5a63b92a411057bd6934052df59836e6eadb1078..9bc2246e4ea01c0dfbb5554fa31969bafe85af2a 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -2285,6 +2285,7 @@ void HTMLMediaElement::setMuted(bool muted)
return;
bool wasAutoplayingMuted = !paused() && m_muted && isLockedPendingUserGesture();
+ bool wasPendingAutoplayMuted = m_autoplayVisibilityObserver && paused() && m_muted && isLockedPendingUserGesture();
if (UserGestureIndicator::processingUserGesture())
unlockUserGesture();
@@ -2311,6 +2312,13 @@ void HTMLMediaElement::setMuted(bool muted)
recordAutoplayUnmuteStatus(AutoplayUnmuteActionSuccess);
}
}
+
+ // If an element was a candidate for autoplay muted but not visible, it will
+ // have a visibility observer ready to start its playback.
+ if (wasPendingAutoplayMuted) {
+ m_autoplayVisibilityObserver->stop();
+ m_autoplayVisibilityObserver = nullptr;
+ }
}
void HTMLMediaElement::updateVolume()
« no previous file with comments | « third_party/WebKit/LayoutTests/media/autoplay-unmute-offscreen.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698