Skip to content
This repository was archived by the owner on Jan 4, 2019. It is now read-only.

Commit a3fff6b

Browse files
committed
1. Audio element should also repect auotplay setting
fix brave/browser-laptop#11988 fix brave/browser-laptop#11527 2. Don't check user initiated video fix brave/browser-laptop#12149 3. Default allow muted media fix brave/browser-laptop#12152 4. Default allow for local files fix brave/browser-laptop#8929 Auditors: @bridiver, @bbondy, @bsclifton
1 parent 222e579 commit a3fff6b

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

patches/master_patch.patch

+10-17
Original file line numberDiff line numberDiff line change
@@ -1883,22 +1883,10 @@ index 76a36536f92ca5cc361e35cb8e27de1bbcc88327..004e678da6e383cfb97fbd7022d9faca
18831883
if (GetWebMediaPlayer())
18841884
GetWebMediaPlayer()->SetVolume(EffectiveMediaVolume());
18851885
diff --git a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp
1886-
index 8adf2d1030ccb91f438d936e94175b20b389f858..2f3b3fdb109cc9bc447d554acdce1a7f0b27cdd8 100644
1886+
index 8adf2d1030ccb91f438d936e94175b20b389f858..c37964ce6cf903a8507e41df017c0932198a5934 100644
18871887
--- a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp
18881888
+++ b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp
1889-
@@ -264,6 +264,11 @@ void AutoplayPolicy::UnlockUserGesture() {
1890-
}
1891-
1892-
bool AutoplayPolicy::IsGestureNeededForPlayback() const {
1893-
+ // MUON(darkdh): check autoplay setting
1894-
+ if (!IsAutoplayAllowedPerSettings()) {
1895-
+ return true;
1896-
+ }
1897-
+
1898-
if (!IsLockedPendingUserGesture())
1899-
return false;
1900-
1901-
@@ -280,14 +285,16 @@ bool AutoplayPolicy::IsGestureNeededForPlaybackIfPendingUserGestureIsLocked()
1889+
@@ -280,15 +280,20 @@ bool AutoplayPolicy::IsGestureNeededForPlaybackIfPendingUserGestureIsLocked()
19021890
// - Data Saver is not enabled;
19031891
// - Preload was not disabled (low end devices);
19041892
// - Autoplay is enabled in settings;
@@ -1910,6 +1898,7 @@ index 8adf2d1030ccb91f438d936e94175b20b389f858..2f3b3fdb109cc9bc447d554acdce1a7f
19101898
- element_->GetDocument()
19111899
- .GetSettings()
19121900
- ->GetForcePreloadNoneForMediaElements()) &&
1901+
- IsAutoplayAllowedPerSettings()) {
19131902
+ // if (element_->IsHTMLVideoElement() && element_->muted() &&
19141903
+ // RuntimeEnabledFeatures::AutoplayMutedVideosEnabled() &&
19151904
+ // !(element_->GetDocument().GetSettings() &&
@@ -1918,11 +1907,15 @@ index 8adf2d1030ccb91f438d936e94175b20b389f858..2f3b3fdb109cc9bc447d554acdce1a7f
19181907
+ // element_->GetDocument()
19191908
+ // .GetSettings()
19201909
+ // ->GetForcePreloadNoneForMediaElements()) &&
1921-
+ // MUON(darkdh): only check autoplay setting
1922-
+ if (element_->IsHTMLVideoElement() &&
1923-
IsAutoplayAllowedPerSettings()) {
1910+
+ // MUON(darkdh): default allow muted media and local files
1911+
+ // only check autoplay setting for non-muted and non-local one
1912+
+ if ((element_->IsHTMLVideoElement() || element_->IsAudioElement()) &&
1913+
+ (element_->muted() ||
1914+
+ element_->GetDocument().origin() == String("null") ||
1915+
+ IsAutoplayAllowedPerSettings())) {
19241916
return false;
19251917
}
1918+
19261919
diff --git a/third_party/boringssl/BUILD.generated.gni b/third_party/boringssl/BUILD.generated.gni
19271920
index 0e96ff54ff898080fef9f132f37b3a1f75b4d8fe..8362d3d55394372b54a4c0234d562bc698155347 100644
19281921
--- a/third_party/boringssl/BUILD.generated.gni

0 commit comments

Comments
 (0)