@@ -1893,46 +1893,51 @@ 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..929da1fa1cd6ed005f219f5855d65edf1662fa4a 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,20 @@ 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
+ + if ((element_->IsHTMLVideoElement() && element_->muted() &&
1908
+ + RuntimeEnabledFeatures::AutoplayMutedVideosEnabled()))
1909
+ + return false;
1910
+ +
1911
+ // We want to allow muted video to autoplay if:
1912
+ // - the flag is enabled;
1912
1913
// - Data Saver is not enabled;
1913
1914
// - Preload was not disabled (low end devices);
1914
1915
// - 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() &&
1916
+ + // MUON(darkdh): don't check autoplay setting for muted video
1917
+ if (element_->IsHTMLVideoElement() && element_->muted() &&
1918
+ RuntimeEnabledFeatures::AutoplayMutedVideosEnabled() &&
1919
+ !(element_->GetDocument().GetSettings() &&
1920
+ @@ -287,11 +296,20 @@ bool AutoplayPolicy::IsGestureNeededForPlaybackIfPendingUserGestureIsLocked()
1921
+ !(element_->GetDocument().GetSettings() &&
1922
+ element_->GetDocument()
1923
+ .GetSettings()
1924
+ + #if defined(MUON_CHROMIUM_BUILD)
1925
+ ->GetForcePreloadNoneForMediaElements()) &&
1933
1926
IsAutoplayAllowedPerSettings()) {
1927
+ + #else
1928
+ + ->GetForcePreloadNoneForMediaElements())) {
1929
+ + #endif
1934
1930
return false;
1935
1931
}
1932
+
1933
+ + // MUON(darkdh): check autoplay setting for media element
1934
+ + if ((element_->IsHTMLVideoElement() || element_->IsAudioElement()) &&
1935
+ + IsAutoplayAllowedPerSettings())
1936
+ + return false;
1937
+ +
1938
+ return true;
1939
+ }
1940
+
1936
1941
diff --git a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp
1937
1942
index 7ee2fa858b93e1dd42ac27f982fb61eaf597aad4..b1c96c229077859865fd5ea03cdbd7747880e216 100644
1938
1943
--- a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp
0 commit comments