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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2071793003: Use data saver information to decide whether to preload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autoplay-visibility
Patch Set: keep connection check Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-preload-datasaver.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a1e7f115b9e08babd82193297c094665ff66223b..4a4650cf9a1fcaf5c78fe3cf7c456ee11c1504f2 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -2000,8 +2000,9 @@ void HTMLMediaElement::setPreload(const AtomicString& preload)
WebMediaPlayer::Preload HTMLMediaElement::preloadType() const
{
- // Force preload to none for cellular connections.
- if (networkStateNotifier().isCellularConnectionType()) {
+ // Force preload to none for cellular connections or when data saver is explicitly set.
+ if (networkStateNotifier().isCellularConnectionType()
+ || (document().settings() && document().settings()->dataSaverEnabled())) {
UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadForcedNone);
return WebMediaPlayer::PreloadNone;
}
@@ -2040,7 +2041,7 @@ String HTMLMediaElement::effectivePreload() const
WebMediaPlayer::Preload HTMLMediaElement::effectivePreloadType() const
{
- if (autoplay())
+ if (autoplay() && !isGestureNeededForPlayback())
return WebMediaPlayer::PreloadAuto;
WebMediaPlayer::Preload preload = preloadType();
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-preload-datasaver.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698