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

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

Issue 2251073003: Pretend the video has no audio track if it is playing as part of autoplay muted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit tests Created 4 years, 2 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 e9f9ba3a2b7fbdbf2ffd4e583e8cf446beea7d72..4de7e7601fe5a9b65415c2be6c4d66822413644f 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -2292,10 +2292,6 @@ void HTMLMediaElement::setMuted(bool muted) {
m_muted = muted;
m_autoplayHelper->mutedChanged();
- updateVolume();
-
- scheduleEvent(EventTypeNames::volumechange);
-
// If an element autoplayed while muted, it needs to be unlocked to unmute,
// otherwise, it will be paused.
if (wasAutoplayingMuted) {
@@ -2309,6 +2305,10 @@ void HTMLMediaElement::setMuted(bool muted) {
}
}
+ updateVolume();
+
+ scheduleEvent(EventTypeNames::volumechange);
+
// 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) {
@@ -3018,6 +3018,14 @@ void HTMLMediaElement::cancelledRemotePlaybackRequest() {
remotePlaybackClient()->promptCancelled();
}
+bool HTMLMediaElement::isAutoplayingMuted() {
+ if (!isHTMLVideoElement() ||
+ !RuntimeEnabledFeatures::autoplayMutedVideosEnabled())
+ return false;
+
+ return muted() && isLockedPendingUserGesture();
+}
+
void HTMLMediaElement::requestReload(const WebURL& newUrl) {
DCHECK(webMediaPlayer());
DCHECK(!m_srcObject);

Powered by Google App Engine
This is Rietveld 408576698