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

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: fix 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 7d88fc290a96ebbcab97133b577b56a7a49b07f2..79681ec8c51f0de70f99218df24faf649d969344 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);
foolip 2016/10/10 11:33:07 This will change the order of events from volumech
mlamouri (slow - plz ping) 2016/10/31 15:27:41 Just to clarify, do you want me to revert the chan
foolip 2016/11/01 16:12:21 Maintaining the event order seems best, yeah.
+
// 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();
foolip 2016/10/10 11:33:07 This will return true even if not actually playing
mlamouri (slow - plz ping) 2016/10/31 15:27:41 That was on purpose but I've added a check to make
+}
+
void HTMLMediaElement::requestReload(const WebURL& newUrl) {
DCHECK(webMediaPlayer());
DCHECK(!m_srcObject);
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | third_party/WebKit/public/platform/WebMediaPlayerClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698