Chromium Code Reviews| 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 441ee5b55a8b6e020d888087c1062bc553bea0e0..50c260c45b7fe8fa549208ac4a36478718a08463 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| @@ -431,6 +431,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
| , m_remoteRoutesAvailable(false) |
| , m_playingRemotely(false) |
| , m_inOverlayFullscreenVideo(false) |
| + , m_isAutoplayingMuted(false) |
| , m_audioTracks(AudioTrackList::create(*this)) |
| , m_videoTracks(VideoTrackList::create(*this)) |
| , m_textTracks(nullptr) |
| @@ -2260,6 +2261,9 @@ void HTMLMediaElement::setMuted(bool muted) |
| { |
| DVLOG(MEDIA_LOG_LEVEL) << "setMuted(" << (void*)this << ", " << boolString(muted) << ")"; |
| + if (UserGestureIndicator::processingUserGesture()) |
| + unlockUserGesture(); |
| + |
| if (m_muted == muted) |
| return; |
| @@ -2274,6 +2278,13 @@ void HTMLMediaElement::setMuted(bool muted) |
| Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute_Off")); |
| scheduleEvent(EventTypeNames::volumechange); |
| + |
| + if (!muted && m_isAutoplayingMuted) { |
|
foolip
2016/06/09 11:41:43
As per https://github.com/whatwg/html/issues/976 I
|
| + // Pause the element autoplayed muted when unmuting if there was no user gesture. |
| + if (isLockedPendingUserGesture()) |
| + pause(); |
| + m_isAutoplayingMuted = false; |
| + } |
| } |
| void HTMLMediaElement::updateVolume() |
| @@ -3671,13 +3682,17 @@ void HTMLMediaElement::unlockUserGesture() |
| m_lockedPendingUserGesture = false; |
| } |
| -bool HTMLMediaElement::isGestureNeededForPlayback() const |
| +bool HTMLMediaElement::isGestureNeededForPlayback() |
| { |
| + m_isAutoplayingMuted = false; |
| + |
| if (!m_lockedPendingUserGesture) |
| return false; |
| - if (muted() && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) |
| + if (muted() && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { |
| + m_isAutoplayingMuted = true; |
| return false; |
| + } |
| if (m_autoplayHelper->isGestureRequirementOverridden()) |
| return false; |