From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Thu, 25 Oct 2018 23:13:34 +0200
Subject: Add flag to control video playback resume feature

Disable it by default on Android as it is everywhere else
---
 chrome/browser/about_flags.cc       | 4 ++++
 chrome/browser/flag_descriptions.cc | 5 +++++
 chrome/browser/flag_descriptions.h  | 3 +++
 media/base/media_switches.cc        | 6 +-----
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1407,6 +1407,10 @@ const FeatureEntry kFeatureEntries[] = {
      flag_descriptions::kVideoPlayerChromecastSupportDescription, kOsCrOS,
      SINGLE_VALUE_TYPE(
          chromeos::switches::kEnableVideoPlayerChromecastSupport)},
+    {"resume-background-video",
+     flag_descriptions::kResumeBackgroundVideoName,
+     flag_descriptions::kResumeBackgroundVideoDescription, kOsAll,
+     FEATURE_VALUE_TYPE(media::kResumeBackgroundVideo)},
     {"list-all-display-modes", flag_descriptions::kListAllDisplayModesName,
      flag_descriptions::kListAllDisplayModesDescription, kOsCrOS,
      FEATURE_VALUE_TYPE(display::features::kListAllDisplayModes)},
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -840,6 +840,11 @@ const char kEnablePictureInPictureDescription[] =
     "controls. The #enable-surfaces-for-videos flag must be enabled as well "
     "to use it.";
 
+const char kResumeBackgroundVideoName[] = "Resume background video.";
+const char kResumeBackgroundVideoDescription[] =
+    "Resume background video playback when tab re-gains focus; additionally, "
+    "it will pause video playback every single time you switch tabs.";
+
 const char kEnablePixelCanvasRecordingName[] = "Enable pixel canvas recording";
 const char kEnablePixelCanvasRecordingDescription[] =
     "Pixel canvas recording allows the compositor to raster contents aligned "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -495,6 +495,9 @@ extern const char kEnableNewDownloadBackendDescription[];
 extern const char kEnablePictureInPictureName[];
 extern const char kEnablePictureInPictureDescription[];
 
+extern const char kResumeBackgroundVideoName[];
+extern const char kResumeBackgroundVideoDescription[];
+
 extern const char kEnablePixelCanvasRecordingName[];
 extern const char kEnablePixelCanvasRecordingDescription[];
 
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc
--- a/media/base/media_switches.cc
+++ b/media/base/media_switches.cc
@@ -205,11 +205,7 @@ const base::Feature kPreloadMetadataLazyLoad{"PreloadMetadataLazyLoad",
 // when in background.
 const base::Feature kResumeBackgroundVideo {
   "resume-background-video",
-#if defined(OS_ANDROID)
-      base::FEATURE_ENABLED_BY_DEFAULT
-#else
-      base::FEATURE_DISABLED_BY_DEFAULT
-#endif
+   base::FEATURE_DISABLED_BY_DEFAULT
 };
 
 // Enable Media Capabilities with finch-parameters.
-- 
2.11.0

