@@ -1893,46 +1893,47 @@ index 19c7b569f19849f8fbb26c1faf2ac52f8fe7c566..0294416a183a13cd925adf89dd587289
1893
1893
if (GetWebMediaPlayer())
1894
1894
GetWebMediaPlayer()->SetVolume(EffectiveMediaVolume());
1895
1895
diff --git a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp
1896
- index 9162bc3ba51153a494aa218007511054cdebbad7..e685ea161db22661d3a643cd37df8924c4439d15 100644
1896
+ index 9162bc3ba51153a494aa218007511054cdebbad7..e1776d21d947705b0ae0a7b6070ef137e980c161 100644
1897
1897
--- a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp
1898
1898
+++ b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp
1899
- @@ -264,6 +264,11 @@ void AutoplayPolicy::UnlockUserGesture() {
1900
- }
1901
-
1902
- bool AutoplayPolicy::IsGestureNeededForPlayback() const {
1903
- + // MUON(darkdh): check autoplay setting
1904
- + if (!IsAutoplayAllowedPerSettings()) {
1905
- + return true;
1906
- + }
1907
- +
1908
- if (!IsLockedPendingUserGesture())
1899
+ @@ -275,11 +275,16 @@ bool AutoplayPolicy::IsGestureNeededForPlaybackIfPendingUserGestureIsLocked()
1900
+ if (element_->GetLoadType() == WebMediaPlayer::kLoadTypeMediaStream)
1909
1901
return false;
1910
1902
1911
- @@ -280,14 +285,16 @@ bool AutoplayPolicy::IsGestureNeededForPlaybackIfPendingUserGestureIsLocked()
1903
+ + // MUON(darkdh): default allow local files
1904
+ + if (element_->GetDocument().origin() == String("null"))
1905
+ + return false;
1906
+ +
1907
+ // We want to allow muted video to autoplay if:
1908
+ // - the flag is enabled;
1912
1909
// - Data Saver is not enabled;
1913
1910
// - Preload was not disabled (low end devices);
1914
1911
// - Autoplay is enabled in settings;
1915
- - if (element_->IsHTMLVideoElement() && element_->muted() &&
1916
- - RuntimeEnabledFeatures::AutoplayMutedVideosEnabled() &&
1917
- - !(element_->GetDocument().GetSettings() &&
1918
- - element_->GetDocument().GetSettings()->GetDataSaverEnabled()) &&
1919
- - !(element_->GetDocument().GetSettings() &&
1920
- - element_->GetDocument()
1921
- - .GetSettings()
1922
- - ->GetForcePreloadNoneForMediaElements()) &&
1923
- + // if (element_->IsHTMLVideoElement() && element_->muted() &&
1924
- + // RuntimeEnabledFeatures::AutoplayMutedVideosEnabled() &&
1925
- + // !(element_->GetDocument().GetSettings() &&
1926
- + // element_->GetDocument().GetSettings()->GetDataSaverEnabled()) &&
1927
- + // !(element_->GetDocument().GetSettings() &&
1928
- + // element_->GetDocument()
1929
- + // .GetSettings()
1930
- + // ->GetForcePreloadNoneForMediaElements()) &&
1931
- + // MUON(darkdh): only check autoplay setting
1932
- + if (element_->IsHTMLVideoElement() &&
1912
+ + // MUON(darkdh): don't check autoplay setting for muted video
1913
+ if (element_->IsHTMLVideoElement() && element_->muted() &&
1914
+ RuntimeEnabledFeatures::AutoplayMutedVideosEnabled() &&
1915
+ !(element_->GetDocument().GetSettings() &&
1916
+ @@ -287,11 +292,20 @@ bool AutoplayPolicy::IsGestureNeededForPlaybackIfPendingUserGestureIsLocked()
1917
+ !(element_->GetDocument().GetSettings() &&
1918
+ element_->GetDocument()
1919
+ .GetSettings()
1920
+ + #if defined(MUON_CHROMIUM_BUILD)
1921
+ ->GetForcePreloadNoneForMediaElements()) &&
1933
1922
IsAutoplayAllowedPerSettings()) {
1923
+ + #else
1924
+ + ->GetForcePreloadNoneForMediaElements())) {
1925
+ + #endif
1934
1926
return false;
1935
1927
}
1928
+
1929
+ + // MUON(darkdh): check autoplay setting for media element
1930
+ + if ((element_->IsHTMLVideoElement() || element_->IsAudioElement()) &&
1931
+ + IsAutoplayAllowedPerSettings())
1932
+ + return false;
1933
+ +
1934
+ return true;
1935
+ }
1936
+
1936
1937
diff --git a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp
1937
1938
index 7ee2fa858b93e1dd42ac27f982fb61eaf597aad4..b1c96c229077859865fd5ea03cdbd7747880e216 100644
1938
1939
--- a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp
0 commit comments