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 58f83cf70ca2b10351234242c41770ca26edb674..a6ce3a1aca4869adf9b9eee07e3114fdf3d8335c 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
@@ -2292,6 +2292,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(); |
@@ -2313,6 +2314,13 @@ void HTMLMediaElement::setMuted(bool muted) |
m_autoplayUmaHelper->recordAutoplayUnmuteStatus(AutoplayUnmuteActionStatus::Success); |
} |
} |
+ |
+ // 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() |