[M108 Migration][MM] Suspend a video if sent to background. 14/289614/3
authorKoyyani Maheswari <m.koyyani@samsung.com>
Fri, 10 Mar 2023 09:41:09 +0000 (15:11 +0530)
committerBot Blink <blinkbot@samsung.com>
Fri, 10 Mar 2023 13:39:53 +0000 (13:39 +0000)
The video playback is abnormal when switching tabs in web browser.
This patch suspends a video sent to background.

Reference: https://review.tizen.org/gerrit/285247/

Change-Id: Ia429bcbfb3a4ce6b4d005694a7dd27a566a10903
Signed-off-by: Koyyani Maheswari <m.koyyani@samsung.com>
third_party/blink/renderer/platform/media/web_media_player_impl.cc

index a61dad6..4e9ffc6 100644 (file)
@@ -2649,8 +2649,14 @@ void WebMediaPlayerImpl::OnFrameHidden() {
   DCHECK(main_task_runner_->BelongsToCurrentThread());
 
   // Backgrounding a video requires a user gesture to resume playback.
-  if (IsHidden())
+  if (IsHidden()) {
+#if defined(TIZEN_MULTIMEDIA)
+    // Suspend if the video is sent to background.
+    PauseVideoIfNeeded();
+    SetSuspendState(true);
+#endif
     video_locked_when_paused_when_hidden_ = true;
+  }
 
   if (watch_time_reporter_)
     watch_time_reporter_->OnHidden();