Delay sending playing event for HbbTV in both code paths. 31/318831/2 submit/tizen/20241014.160015
authorMark Toller <mark.toller@samsung.com>
Wed, 9 Oct 2024 09:41:54 +0000 (10:41 +0100)
committerBot Blink <blinkbot@samsung.com>
Mon, 14 Oct 2024 13:07:09 +0000 (13:07 +0000)
Change-Id: Ie941a782682e5f50735aac82a3895fd4a3ae4acd

third_party/blink/renderer/core/html/media/html_media_element.cc

index 621431d713148c33f7ee209babd9185597c836e7..7ec9464bf2cd203931fe37857337e8dfce005f19 100644 (file)
@@ -3060,16 +3060,20 @@ void HTMLMediaElement::PlayInternal() {
     GetCueTimeline().InvokeTimeMarchesOn();
     ScheduleEvent(event_type_names::kPlay);
 
-    if (ready_state_ <= kHaveCurrentData)
-      ScheduleEvent(event_type_names::kWaiting);
-    else if (ready_state_ >= kHaveFutureData) {
 #if BUILDFLAG(IS_TIZEN_TV)
-      if (IsHbbTV()) {
-        LOG(INFO) << "HbbTV: Send playing event on first timeupdate";
-        playing_event_pending_ = true;
-      }
+    // For HbbTV, there are tests which require the playing
+    // event to be sent only when we're actually playing, and
+    // not before.  So in this case, we will only send the playing
+    // event once the time update event has progressed.
+    if (IsHbbTV()) {
+      LOG(INFO) << "HbbTV: Send playing event on first timeupdate";
+      playing_event_pending_ = true;
+    }
 #endif
 
+    if (ready_state_ <= kHaveCurrentData)
+      ScheduleEvent(event_type_names::kWaiting);
+    else if (ready_state_ >= kHaveFutureData) {
       ScheduleNotifyPlaying();
     }
   } else if (ready_state_ >= kHaveFutureData) {
@@ -3537,6 +3541,7 @@ void HTMLMediaElement::ScheduleTimeupdateEvent(bool periodic_event) {
 
 #if BUILDFLAG(IS_TIZEN_TV)
   if (IsHbbTV() && playing_event_pending_) {
+    LOG(INFO) << "Time update progressed, send delayed playing event";
     playing_event_pending_ = false;
     ScheduleNotifyPlaying();
   }
@@ -5655,10 +5660,9 @@ void HTMLMediaElement::ScheduleRejectPlayPromises(PlayPromiseError code) {
 
 void HTMLMediaElement::ScheduleNotifyPlaying() {
   if (playing_event_pending_) {
-    LOG(INFO) << "Playing event is pending in timeupdate";
+    LOG(INFO) << "Wait for time update before generating playing event";
     return;
   }
-  LOG(INFO) << "Playing event is NOT pending";
 
   ScheduleEvent(event_type_names::kPlaying);
   ScheduleResolvePlayPromises();