[M108 Aura Migration][MM] Enable media auto-playback 19/285119/5
authorlokeshmeena <lokesh.meena@samsung.com>
Tue, 6 Dec 2022 10:38:05 +0000 (16:08 +0530)
committerDae-Hyun Ko <dhyuna.ko@samsung.com>
Thu, 8 Dec 2022 02:39:01 +0000 (02:39 +0000)
Chrome has introduced Autoplay Policy and enables playback based on
use guesture. This patch is to allow auto-playback media on tizen based
on attributes only and Removed volume checks.

W3C spec:
https://www.w3.org/TR/2011/WD-html5-20110113/video.html#attr-media-autoplay

Reference:
https://review.tizen.org/gerrit/270035
https://review.tizen.org/gerrit/268636

Change-Id: If9a47d5f108192dc9f75386cbf9434f030bea03f
Signed-off-by: lokeshmeena <lokesh.meena@samsung.com>
media/base/media_switches.cc
third_party/blink/common/web_preferences/web_preferences.cc
third_party/blink/renderer/core/html/media/autoplay_policy.cc

index 24b2208..8a87cc2 100644 (file)
@@ -1080,6 +1080,10 @@ std::string GetEffectiveAutoplayPolicy(const base::CommandLine& command_line) {
   if (command_line.HasSwitch(switches::kAutoplayPolicy))
     return command_line.GetSwitchValueASCII(switches::kAutoplayPolicy);
 
+#if defined(TIZEN_MULTIMEDIA)
+  return switches::autoplay::kNoUserGestureRequiredPolicy;
+#endif
+
   if (base::FeatureList::IsEnabled(media::kUnifiedAutoplay))
     return switches::autoplay::kDocumentUserActivationRequiredPolicy;
 
index 8679167..2257cb2 100644 (file)
@@ -197,8 +197,12 @@ WebPreferences::WebPreferences()
       presentation_receiver(false),
       media_controls_enabled(true),
       do_not_update_selection_on_mutating_selection_range(false),
+#if defined(TIZEN_MULTIMEDIA)
+      autoplay_policy(blink::mojom::AutoplayPolicy::kNoUserGestureRequired),
+#else
       autoplay_policy(
           blink::mojom::AutoplayPolicy::kDocumentUserActivationRequired),
+#endif
       low_priority_iframes_threshold(
           EffectiveConnectionType::kEffectiveConnectionUnknownType),
       picture_in_picture_enabled(true),
index 3a7a3d9..ed53719 100644 (file)
@@ -188,8 +188,12 @@ bool AutoplayPolicy::IsEligibleForAutoplayMuted() const {
     return false;
   }
 
+#if defined(TIZEN_MULTIMEDIA)
+  return DocumentShouldAutoplayMutedVideos(element_->GetDocument());
+#else
   return !element_->EffectiveMediaVolume() &&
          DocumentShouldAutoplayMutedVideos(element_->GetDocument());
+#endif
 }
 
 void AutoplayPolicy::StartAutoplayMutedWhenVisible() {