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

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

Issue 2250393002: Cancel autoplay muted when visible if the video gets unmuted before being visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 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()
« 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