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

License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
 chrome/browser/about_flags.cc       | 4 ++++
 chrome/browser/flag_descriptions.cc | 5 +++++
 chrome/browser/flag_descriptions.h  | 3 +++
 media/base/media_switches.cc        | 8 ++------
 4 files changed, 14 insertions(+), 6 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
@@ -3661,6 +3661,10 @@ const FeatureEntry kFeatureEntries[] = {
      SINGLE_VALUE_TYPE(extensions::switches::kExtensionsOnChromeURLs)},
 #endif  // ENABLE_EXTENSIONS
 #if BUILDFLAG(IS_ANDROID)
+    {"resume-background-video",
+     flag_descriptions::kResumeBackgroundVideoName,
+     flag_descriptions::kResumeBackgroundVideoDescription, kOsAll,
+     FEATURE_VALUE_TYPE(media::kResumeBackgroundVideo)},
     {"osk-resizes-visual-viewport-by-default",
      flag_descriptions::kEnableOskResizesVisualViewportByDefaultName,
      flag_descriptions::kEnableOskResizesVisualViewportByDefaultDescription,
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
@@ -1363,6 +1363,11 @@ const char kEnablePenetratingImageSelectionDescription[] =
     "Enables image options to be surfaced in the context menu for nodes "
     "covered by transparent overlays.";
 
+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
@@ -744,6 +744,9 @@ extern const char kEnablePortalsDescription[];
 extern const char kEnablePortalsCrossOriginName[];
 extern const char kEnablePortalsCrossOriginDescription[];
 
+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
@@ -302,12 +302,8 @@ BASE_FEATURE(kPreloadMetadataLazyLoad,
 // Let videos be resumed via remote controls (for example, the notification)
 // when in background.
 BASE_FEATURE(kResumeBackgroundVideo,
-             "resume-background-video",
-#if BUILDFLAG(IS_ANDROID)
-             base::FEATURE_ENABLED_BY_DEFAULT
-#else
-             base::FEATURE_DISABLED_BY_DEFAULT
-#endif
+             "resume-background-video",           // disabled by default
+             base::FEATURE_DISABLED_BY_DEFAULT    // in Bromite
 );
 
 // When enabled, MediaCapabilities will check with GPU Video Accelerator
--
2.25.1
