[M120 Migration][MM] Support webmedia playback state notification 20/307120/4
authorzhishun.zhou <zhishun.zhou@samsung.com>
Tue, 5 Mar 2024 06:08:38 +0000 (14:08 +0800)
committerzhishun.zhou <zhishun.zhou@samsung.com>
Tue, 5 Mar 2024 09:27:56 +0000 (17:27 +0800)
1. webbrowser need playbackstart event to show miniplayer button,
   this patch implement ewk interface to notify player state to APP,
   at the same time it get translated url and drm information from APP;
2. Impement a switch kEnableMediaPlaybackNotification, set from
   ewk_settings_media_playback_notification_set;
3. Impement GetContentMIMEType from html media element and set it to esplayer;

Patch from:
https://review.tizen.org/gerrit/#/c/292410/

Change-Id: I88c787896baa4176769c3eb64214d94bee72ffaa
Signed-off-by: xiaofang <fang.xiao@samsung.com>
Signed-off-by: zhishun.zhou <zhishun.zhou@samsung.com>
46 files changed:
content/browser/web_contents/web_contents_impl.cc
content/public/browser/web_contents_delegate.h
content/public/common/content_switches.cc
content/public/common/content_switches.h
media/base/pipeline.h
media/base/pipeline_impl.cc
media/base/pipeline_impl.h
media/base/renderer.h
media/filters/pipeline_controller.cc
media/filters/pipeline_controller.h
media/mojo/clients/mojo_renderer.cc
media/mojo/clients/mojo_renderer.h
media/mojo/clients/mojo_renderer_wrapper.cc
media/mojo/clients/mojo_renderer_wrapper.h
media/mojo/mojom/renderer.mojom
media/mojo/services/mojo_renderer_service.cc
media/mojo/services/mojo_renderer_service.h
net/base/mime_util.cc
third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
third_party/blink/public/common/web_preferences/web_preferences.h
third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
third_party/blink/public/mojom/webpreferences/web_preferences.mojom
third_party/blink/public/platform/web_media_player_client.h
third_party/blink/public/web/web_settings.h
third_party/blink/renderer/core/exported/web_settings_impl.cc
third_party/blink/renderer/core/exported/web_settings_impl.h
third_party/blink/renderer/core/exported/web_view_impl.cc
third_party/blink/renderer/core/frame/settings.h
third_party/blink/renderer/core/html/media/html_media_element.cc
third_party/blink/renderer/core/html/media/html_media_element.h
third_party/blink/renderer/platform/media/web_media_player_impl.cc
tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc
tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h
tizen_src/chromium_impl/media/filters/media_player_bridge_capi.h
tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc
tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h
tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.cc
tizen_src/chromium_impl/media/filters/media_player_tizen.h
tizen_src/chromium_impl/media/filters/media_player_tizen_client.h
tizen_src/ewk/efl_integration/BUILD.gn
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/public/ewk_media_playback_info.cc
tizen_src/ewk/efl_integration/public/ewk_settings.cc
tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc
tizen_src/ewk/efl_integration/web_contents_delegate_efl.h

index c2d2248..46ae83a 100644 (file)
@@ -3229,6 +3229,12 @@ const blink::web_pref::WebPreferences WebContentsImpl::ComputeWebPreferences() {
   prefs.user_gesture_required_for_presentation = !command_line.HasSwitch(
       switches::kDisableGestureRequirementForPresentation);
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  // Disallow media playback notification by default.
+  prefs.media_playback_notification_enabled =
+      command_line.HasSwitch(switches::kEnableMediaPlaybackNotification);
+#endif
+
 #if BUILDFLAG(IS_TIZEN)
   if (command_line.HasSwitch(switches::kMaxRefreshRate)) {
     int refresh_rate = 0;
index 8776ed2..2bf3192 100644 (file)
@@ -735,10 +735,17 @@ class CONTENT_EXPORT WebContentsDelegate {
   virtual void ExitPictureInPicture() {}
 
 #if BUILDFLAG(IS_TIZEN_TV)
+  virtual void NotifyPlaybackState(int state,
+                                   int player_id,
+                                   const std::string& url,
+                                   const std::string& mime_type,
+                                   bool* media_resource_acquired,
+                                   std::string* translated_url,
+                                   std::string* drm_info) {}
   // Notify Media State to Web browser
   virtual void NotifyMediaStateChanged(uint32_t type,
                                        uint32_t previous,
-                                       uint32_t current) {};
+                                       uint32_t current) {}
   virtual bool IsHighBitRate() const { return false; }
   virtual void NotifyDownloadableFontInfo(const std::string& scheme_id_uri,
                                           const std::string& value,
index 7b03c23..7f95a83 100644 (file)
@@ -1078,6 +1078,9 @@ const char kMaxRefreshRate[] = "max-refresh-rate";
 #endif
 
 #if BUILDFLAG(IS_TIZEN_TV)
+// Enables media playback notification for other applications
+const char kEnableMediaPlaybackNotification[] =
+    "enable-media-playback-notification";
 // Enables dual decoding for webrtc video call
 const char kDualDecodingWebRTC[] = "enable-webrtc-dual-decoding";
 // Enables multiplayers feature for web app
index 886b0f9..a851eed 100644 (file)
@@ -300,6 +300,7 @@ CONTENT_EXPORT extern const char kMaxRefreshRate[];
 #endif
 
 #if BUILDFLAG(IS_TIZEN_TV)
+CONTENT_EXPORT extern const char kEnableMediaPlaybackNotification[];
 CONTENT_EXPORT extern const char kDualDecodingWebRTC[];
 CONTENT_EXPORT extern const char kEnableMultiPlayerForWebapp[];
 #endif
index 8e1f221..a2e4554 100644 (file)
@@ -278,6 +278,9 @@ class MEDIA_EXPORT Pipeline {
 #if defined(TIZEN_VIDEO_HOLE)
   virtual void SetMediaGeometry(const gfx::RectF rect_f) = 0;
 #endif
+#if BUILDFLAG(IS_TIZEN_TV)
+  virtual void SetContentMimeType(const std::string& mime_type) = 0;
+#endif
 };
 
 }  // namespace media
index 2b991e6..bf67b12 100644 (file)
@@ -110,6 +110,9 @@ class PipelineImpl::RendererWrapper final : public DemuxerHost,
 #if defined(TIZEN_VIDEO_HOLE)
   void SetMediaGeometry(const gfx::RectF rect_f);
 #endif
+#if BUILDFLAG(IS_TIZEN_TV)
+  void SetContentMimeType(const std::string& mime_type);
+#endif
 
   // |enabled_track_ids| contains track ids of enabled audio tracks.
   void OnEnabledAudioTracksChanged(
@@ -268,6 +271,10 @@ class PipelineImpl::RendererWrapper final : public DemuxerHost,
   bool is_video_hole_;
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  std::string mime_type_;
+#endif
+
   // Whether we've received the audio/video ended events.
   bool renderer_ended_;
 
@@ -677,6 +684,16 @@ void PipelineImpl::RendererWrapper::SetMediaGeometry(const gfx::RectF rect_f) {
 }
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void PipelineImpl::RendererWrapper::SetContentMimeType(
+    const std::string& mime_type) {
+  DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
+  mime_type_ = mime_type;
+  if (shared_state_.renderer)
+    shared_state_.renderer->SetContentMimeType(mime_type_);
+}
+#endif
+
 void PipelineImpl::RendererWrapper::CreateRendererInternal(
     PipelineStatusCallback done_cb) {
   DVLOG(1) << __func__;
@@ -1165,6 +1182,10 @@ void PipelineImpl::RendererWrapper::CompleteSeek(base::TimeDelta seek_time,
     return;
   }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  shared_state_.renderer->SetContentMimeType(mime_type_);
+#endif
+
   shared_state_.renderer->StartPlayingFrom(
       std::max(seek_time, demuxer_->GetStartTime()));
   {
@@ -1300,6 +1321,12 @@ void PipelineImpl::RendererWrapper::InitializeRenderer(
   LOG(INFO) << __func__ << " call SetVideoHole : " << is_video_hole_;
   shared_state_.renderer->SetVideoHole(is_video_hole_);
 #endif
+#if BUILDFLAG(IS_TIZEN_TV)
+  // We need to set the mime type before Initialize() in the case of URL streams
+  // where the content is dash, because the Initialize() calls prepare in this
+  // case, and the player needs the mime type to configure itself correctly.
+  shared_state_.renderer->SetContentMimeType(mime_type_);
+#endif
 
   // Initialize Renderer and report timeout UMA.
   std::string uma_name = "Media.InitializeRendererTimeout";
@@ -1832,6 +1859,16 @@ void PipelineImpl::OnBufferingStateChange(BufferingState state,
   client_->OnBufferingStateChange(state, reason);
 }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void PipelineImpl::SetContentMimeType(const std::string& mime_type) {
+  DVLOG(2) << __func__ << "(" << mime_type << ")";
+  DCHECK(thread_checker_.CalledOnValidThread());
+  media_task_runner_->PostTask(
+      FROM_HERE,
+      base::BindOnce(&RendererWrapper::SetContentMimeType,
+                     base::Unretained(renderer_wrapper_.get()), mime_type));
+}
+#endif
 void PipelineImpl::OnDurationChange(base::TimeDelta duration) {
   DVLOG(2) << __func__;
   DCHECK(thread_checker_.CalledOnValidThread());
index 6d1adf6..cc738ac 100644 (file)
@@ -174,6 +174,9 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline {
   void OnFallback(PipelineStatus fallback);
   void OnEnded();
   void OnMetadata(const PipelineMetadata& metadata);
+#if BUILDFLAG(IS_TIZEN_TV)
+  void SetContentMimeType(const std::string& mime_type) override;
+#endif
   void OnBufferingStateChange(BufferingState state,
                               BufferingStateChangeReason reason);
   void OnDurationChange(base::TimeDelta duration);
index 20b0330..1dc4f6b 100644 (file)
@@ -107,6 +107,10 @@ class MEDIA_EXPORT Renderer {
   virtual void SetMediaGeometry(const gfx::RectF& rect) {}
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  virtual void SetContentMimeType(const std::string& mime_type) {}
+#endif
+
   // Starts rendering from |time|.
   virtual void StartPlayingFrom(base::TimeDelta time) = 0;
 
index 26a9dcc..32cd7d5 100644 (file)
@@ -476,4 +476,10 @@ void PipelineController::OnTrackChangeComplete() {
   Dispatch();
 }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void PipelineController::SetContentMimeType(const std::string& mime_type) {
+  if (pipeline_)
+    pipeline_->SetContentMimeType(mime_type);
+}
+#endif
 }  // namespace media
index 152a2ff..071ce06 100644 (file)
@@ -163,6 +163,9 @@ class MEDIA_EXPORT PipelineController {
   void SetMediaGeometry(gfx::RectF rect_f);
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  void SetContentMimeType(const std::string& mime_type);
+#endif
  private:
   // Attempts to make progress from the current state to the target state.
   void Dispatch();
index f51b9b4..3a2a101 100644 (file)
@@ -343,6 +343,16 @@ void MojoRenderer::OnStatisticsUpdate(const PipelineStatistics& stats) {
   client_->OnStatisticsUpdate(stats);
 }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void MojoRenderer::SetContentMimeType(const std::string& mime_type) {
+  DVLOG(2) << __func__ << " mime_type : " << mime_type;
+  DCHECK(task_runner_->RunsTasksInCurrentSequence());
+
+  if (remote_renderer_.is_bound())
+    remote_renderer_->SetContentMimeType(mime_type);
+}
+#endif
+
 void MojoRenderer::OnWaiting(WaitingReason reason) {
   DVLOG(1) << __func__;
   DCHECK(task_runner_->RunsTasksInCurrentSequence());
index bc24925..918f3d2 100644 (file)
@@ -76,6 +76,10 @@ class MojoRenderer : public Renderer, public mojom::RendererClient {
   void SetMediaGeometry(const gfx::RectF& rect) override;
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  void SetContentMimeType(const std::string& mime_type) override;
+#endif
+
  private:
   // mojom::RendererClient implementation, dispatched on the |task_runner_|.
   void OnTimeUpdate(base::TimeDelta time,
index fda7f0d..823956f 100644 (file)
@@ -76,4 +76,11 @@ base::TimeDelta MojoRendererWrapper::GetMediaTime() {
   return mojo_renderer_->GetMediaTime();
 }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void MojoRendererWrapper::SetContentMimeType(const std::string& mime_type) {
+  if (mojo_renderer_)
+    mojo_renderer_->SetContentMimeType(mime_type);
+}
+#endif
+
 }  // namespace media
index eee5a71..d0e1db3 100644 (file)
@@ -48,6 +48,10 @@ class MojoRendererWrapper : public Renderer {
   void SetMediaGeometry(const gfx::RectF& rect) override;
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  void SetContentMimeType(const std::string& mime_type) override;
+#endif
+
   base::TimeDelta GetMediaTime() override;
 
  private:
index 82a8347..4efe13d 100644 (file)
@@ -67,6 +67,9 @@ interface Renderer {
 
   [EnableIf=tizen_multimedia]
   ToggleFullscreenMode(bool is_fullscreen) => ();
+
+  [EnableIf=is_tizen_tv]
+  SetContentMimeType(string mime_type);
 };
 
 // A Mojo equivalent of media::RendererClient. See media/mojo/README.md
index ce09ae4..4b2b405 100644 (file)
@@ -209,6 +209,14 @@ void MojoRendererService::OnStatisticsUpdate(const PipelineStatistics& stats) {
   client_->OnStatisticsUpdate(stats);
 }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void MojoRendererService::SetContentMimeType(const std::string& mime_type) {
+  DVLOG(3) << __func__ << ", mime_type: " << mime_type;
+  if (renderer_)
+    renderer_->SetContentMimeType(mime_type);
+}
+#endif
+
 void MojoRendererService::OnBufferingStateChange(
     BufferingState state,
     BufferingStateChangeReason reason) {
index 87f08d0..d15ec87 100644 (file)
@@ -82,6 +82,10 @@ class MEDIA_MOJO_EXPORT MojoRendererService final : public mojom::Renderer,
   void SetMediaGeometry(const gfx::RectF& rect) final;
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  void SetContentMimeType(const std::string& mime_type) final;
+#endif
+
  private:
   enum State {
     STATE_UNINITIALIZED,
index d4ac4b8..0d759e0 100644 (file)
@@ -233,6 +233,9 @@ static const MimeInfo kSecondaryMappings[] = {
     {"text/x-sh", "sh"},
     {"text/xml", "xsl,xbl,xslt"},
     {"video/mpeg", "mpeg,mpg"},
+#if BUILDFLAG(IS_TIZEN_TV)
+    {"application/dash+xml", "mpd"},
+#endif
 };
 
 // Finds mime type of |ext| from |mappings|.
index 8cf918b..1c09ddf 100644 (file)
@@ -263,6 +263,8 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
 #if BUILDFLAG(IS_TIZEN_TV)
   out->allow_file_access_from_external_urls =
       data.allow_file_access_from_external_urls();
+  out->media_playback_notification_enabled =
+      data.media_playback_notification_enabled();
 #endif
   return true;
 }
index 67c5df8..cb56a6a 100644 (file)
@@ -320,6 +320,10 @@ struct BLINK_COMMON_EXPORT WebPreferences {
   unsigned tizen_version_release = 0;
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  bool media_playback_notification_enabled = false;
+#endif
+
   // Whether download UI should be hidden on this page.
   bool hide_download_ui;
 
index c4a0153..0ed0971 100644 (file)
@@ -184,6 +184,11 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
       const blink::web_pref::WebPreferences& r) {
     return r.additional_shared_array_buffer_schemes;
   }
+
+  static bool media_playback_notification_enabled(
+      const blink::web_pref::WebPreferences& r) {
+    return r.media_playback_notification_enabled;
+  }
 #endif
 
   static bool webgl1_enabled(const blink::web_pref::WebPreferences& r) {
index 76e3006..617e848 100644 (file)
@@ -530,6 +530,9 @@ struct WebPreferences {
   bool modal_context_menu = true;
 
   [EnableIf=is_tizen_tv]
+  bool media_playback_notification_enabled;
+
+  [EnableIf=is_tizen_tv]
   bool allow_file_access_from_external_urls;
 
   [EnableIf=is_tizen_tv]
index a9ec4d6..3a24a57 100644 (file)
@@ -227,6 +227,10 @@ class BLINK_PLATFORM_EXPORT WebMediaPlayerClient {
   virtual void SuspendPlayer() {}
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  virtual WebString GetContentMIMEType() = 0;
+#endif
+
  protected:
   ~WebMediaPlayerClient() = default;
 };
index 7d12ff7..ab84944 100644 (file)
@@ -306,6 +306,11 @@ class WebSettings {
   virtual void SetVideoHoleEnabled(bool) = 0;
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  virtual void SetMediaPlaybackNotificationEnabled(bool) = 0;
+  virtual bool MediaPlaybackNotificationEnabled() = 0;
+#endif
+
  protected:
   ~WebSettings() = default;
 };
index 34e9c9d..e9d6b3c 100644 (file)
@@ -850,6 +850,16 @@ bool WebSettingsImpl::GetAccessibilityEnabled() {
 }
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void WebSettingsImpl::SetMediaPlaybackNotificationEnabled(bool enabled) {
+  settings_->SetMediaPlaybackNotificationEnabled(enabled);
+}
+
+bool WebSettingsImpl::MediaPlaybackNotificationEnabled() {
+  return settings_->MediaPlaybackNotificationEnabled();
+}
+#endif
+
 #if defined(TIZEN_VIDEO_HOLE)
 void WebSettingsImpl::SetVideoHoleEnabled(bool enabled) {
   settings_->SetVideoHoleEnabled(enabled);
index 7a2a4ca..f64d55d 100644 (file)
@@ -243,6 +243,8 @@ class CORE_EXPORT WebSettingsImpl final : public WebSettings {
 #if BUILDFLAG(IS_TIZEN_TV)
   void SetAllowFileAccessFromExternalURLs(bool) override;
   bool AllowFileAccessFromExternalURLs() override;
+  void SetMediaPlaybackNotificationEnabled(bool) override;
+  bool MediaPlaybackNotificationEnabled() override;
 #endif
 
 #if defined(TIZEN_ATK_SUPPORT)
index e50ecae..9684d22 100644 (file)
@@ -1786,6 +1786,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
 #if BUILDFLAG(IS_TIZEN_TV)
   settings->SetAllowFileAccessFromExternalURLs(
       prefs.allow_file_access_from_external_urls);
+  settings->SetMediaPlaybackNotificationEnabled(
+      prefs.media_playback_notification_enabled);
 #endif
 
 #if BUILDFLAG(IS_EFL)
index d4891f8..f424df9 100644 (file)
@@ -87,6 +87,15 @@ class CORE_EXPORT Settings {
 
   void SetDelegate(SettingsDelegate*);
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  void SetMediaPlaybackNotificationEnabled(bool enabled) {
+    media_playback_notification_enabled_ = enabled;
+  }
+  bool MediaPlaybackNotificationEnabled() const {
+    return media_playback_notification_enabled_;
+  }
+#endif
+
  private:
   void Invalidate(SettingsDelegate::ChangeType);
 
@@ -94,6 +103,10 @@ class CORE_EXPORT Settings {
 
   GenericFontFamilySettings generic_font_family_settings_;
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  bool media_playback_notification_enabled_ : 1 = false;
+#endif
+
 #if BUILDFLAG(IS_EFL)
   struct {
     unsigned major;
index 6c6014b..919f526 100644 (file)
@@ -1353,6 +1353,11 @@ void HTMLMediaElement::LoadResource(const WebMediaPlayerSource& source,
     return;
   }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  ContentType cont_type(content_type);
+  content_mime_type_ = cont_type.GetType().DeprecatedLower();
+#endif
+
   // The resource fetch algorithm
   SetNetworkState(kNetworkLoading);
 
@@ -4029,6 +4034,33 @@ void HTMLMediaElement::ContextDestroyed() {
   removed_from_document_timer_.Stop();
 }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+WebString HTMLMediaElement::GetContentMIMEType() {
+  // If the MIME type is missing or is not meaningful, try to figure it out from
+  // the URL.
+  if (content_mime_type_.empty() ||
+      content_mime_type_ == "application/octet-stream" ||
+      content_mime_type_ == "text/plain") {
+    if (current_src_.GetSourceIfVisible().ProtocolIsData())
+      content_mime_type_ =
+          MimeTypeFromDataURL(current_src_.GetSourceIfVisible().GetString());
+    else {
+      String last_path_component =
+          current_src_.GetSourceIfVisible().LastPathComponent();
+      size_t pos = last_path_component.ReverseFind('.');
+      if (pos != kNotFound) {
+        String extension = last_path_component.Substring(pos + 1);
+        String media_type =
+            MIMETypeRegistry::GetMIMETypeForExtension(extension);
+        if (!media_type.empty())
+          content_mime_type_ = media_type;
+      }
+    }
+  }
+  return WebString(content_mime_type_);
+}
+#endif
+
 bool HTMLMediaElement::HasPendingActivity() const {
   const auto result = HasPendingActivityInternal();
   // TODO(dalecurtis): Replace c-style casts in followup patch.
index 1613b3a..17e783f 100644 (file)
@@ -380,6 +380,10 @@ class CORE_EXPORT HTMLMediaElement
 
   WebMediaPlayer::LoadType GetLoadType() const;
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  WebString GetContentMIMEType() override;
+#endif
+
   bool HasMediaSource() const { return media_source_attachment_.get(); }
 
   // Return true if element is paused and won't resume automatically if it
@@ -866,6 +870,9 @@ class CORE_EXPORT HTMLMediaElement
   bool live_playback_complete_ : 1;
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  String content_mime_type_;
+#endif
   // Set if the user has used the context menu to set the visibility of the
   // controls.
   absl::optional<bool> user_wants_controls_visible_;
index 27d5c3d..47767d0 100644 (file)
@@ -2997,6 +2997,11 @@ media::PipelineStatus WebMediaPlayerImpl::OnDemuxerCreated(
   if (start_type != media::Pipeline::StartType::kNormal) {
     attempting_suspended_start_ = true;
   }
+#if BUILDFLAG(IS_TIZEN_TV)
+  blink::WebString content_mime_type =
+      blink::WebString(client_->GetContentMIMEType());
+  pipeline_controller_->SetContentMimeType(content_mime_type.Utf8());
+#endif
 
   pipeline_controller_->Start(start_type, demuxer, this, is_streaming,
                               is_static);
index e380885..dc2c609 100644 (file)
@@ -61,6 +61,9 @@ TizenRendererImpl::TizenRendererImpl(
 #if defined(TIZEN_VIDEO_HOLE)
       video_rect_(gfx::RectF()),
 #endif
+#if BUILDFLAG(IS_TIZEN_TV)
+      notify_playback_state_(media::kPlaybackStop),
+#endif
       renderer_extension_receiver_(this,
                                    std::move(renderer_extension_receiver)),
       web_contents_(web_contents) {
@@ -472,6 +475,53 @@ void TizenRendererImpl::OnStatisticsUpdate(
     const media::PipelineStatistics& stats) {
   NOTIMPLEMENTED();
 }
+#if BUILDFLAG(IS_TIZEN_TV)
+void TizenRendererImpl::SetContentMimeType(const std::string& mime_type) {
+  mime_type_ = mime_type;
+  if (media_player_)
+    media_player_->SetContentMimeType(mime_type);
+}
+
+bool TizenRendererImpl::PlaybackNotificationEnabled() {
+  content::WebContents* web_contents = GetWebContents();
+  if (!web_contents) {
+    LOG(ERROR) << "web_contents is nullptr";
+    return false;
+  }
+  blink::web_pref::WebPreferences web_preference =
+      web_contents->GetOrCreateWebPreferences();
+  bool enable = web_preference.media_playback_notification_enabled;
+  LOG(INFO) << "media_playback_notification_enabled:" << enable;
+  return enable;
+}
+
+void TizenRendererImpl::NotifyPlaybackState(int state,
+                                            int player_id,
+                                            const std::string& url,
+                                            const std::string& mime_type,
+                                            bool* media_resource_acquired,
+                                            std::string* translated_url,
+                                            std::string* drm_info) {
+  if (!PlaybackNotificationEnabled())
+    return;
+  content::WebContentsDelegate* web_contents_delegate =
+      GetWebContentsDelegate();
+  if (!web_contents_delegate) {
+    LOG(ERROR) << "GetWebContentsDelegate failed";
+    return;
+  }
+
+  if (notify_playback_state_ < media::kPlaybackReady &&
+      state == media::kPlaybackStop) {
+    LOG(ERROR) << "player not Ready but notify Stop";
+  }
+
+  notify_playback_state_ = state;
+  web_contents_delegate->NotifyPlaybackState(state, player_id, url, mime_type,
+                                             media_resource_acquired,
+                                             translated_url, drm_info);
+}
+#endif
 
 void TizenRendererImpl::OnSeekableTimeChange(base::TimeDelta min_time,
                                              base::TimeDelta max_time,
index bac0971..d9e66cd 100644 (file)
@@ -114,6 +114,18 @@ class CONTENT_EXPORT TizenRendererImpl
   void OnVideoSizeChange(const gfx::Size& size) override;
   void OnDurationChange(base::TimeDelta duration) override;
   void OnBufferUpdate(base::TimeDelta time) override;
+
+#if BUILDFLAG(IS_TIZEN_TV)
+  bool PlaybackNotificationEnabled();
+  void NotifyPlaybackState(int state,
+                           int player_id = 0,
+                           const std::string& url = "",
+                           const std::string& mime_type = "",
+                           bool* media_resource_acquired = NULL,
+                           std::string* translated_url = NULL,
+                           std::string* drm_info = NULL) override;
+#endif
+
 #if defined(TIZEN_TBM_SUPPORT)
   void OnNewTbmFrameAvailable(uint32_t player_id,
                               gfx::TbmBufferHandle tbm_handle,
@@ -138,6 +150,10 @@ class CONTENT_EXPORT TizenRendererImpl
   gfx::Rect GetViewportRect() const;
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  void SetContentMimeType(const std::string& mime_type) override;
+#endif
+
  private:
   const float kDefaultVolume = 1.0;
 
@@ -214,6 +230,14 @@ class CONTENT_EXPORT TizenRendererImpl
   gfx::RectF video_rect_;
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  int notify_playback_state_;
+  // Stores the mime type.  Required for URL streams which are DASH
+  // content, so that we can set it to the media_player_ before calling
+  // initialize / prepare.
+  std::string mime_type_;
+#endif
+
   WebContents* web_contents_ = nullptr;
 
   base::WeakPtrFactory<TizenRendererImpl> weak_factory_{this};
index a3c7f27..4085727 100644 (file)
@@ -125,7 +125,9 @@ class MEDIA_EXPORT MediaPlayerBridgeCapi : public MediaPlayerTizen {
                            uint32_t length,
                            base::TimeDelta timestamp);
 #endif
-  MediaPlayerTizenClient* GetMediaPlayerClient() const { return client_; }
+  MediaPlayerTizenClient* GetMediaPlayerClient() const override {
+    return client_;
+  }
   player_state_e GetPlayerState();
 
   // Both used by Tizen TV and other platform
@@ -137,7 +139,7 @@ class MEDIA_EXPORT MediaPlayerBridgeCapi : public MediaPlayerTizen {
   virtual void UpdateDuration();
 
   GURL url_;
-  int player_id_ = 0;;
+  int player_id_ = 0;
   int delayed_player_state_;
   player_h player_ = nullptr;
 
index da8a9a5..a741dfa 100644 (file)
@@ -32,24 +32,61 @@ void MediaPlayerBridgeCapiTV::SetContentMimeType(const std::string& mime_type) {
 }
 
 void MediaPlayerBridgeCapiTV::Prepare() {
+  bool media_resource_acquired = false;
+  std::string translated_url;
+  std::string drm_info;
+
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(
+        kPlaybackLoad, player_id_, url_.spec(), mime_type_,
+        &media_resource_acquired, &translated_url, &drm_info);
+
+  LOG(INFO) << "media_resource_acquired: " << media_resource_acquired
+            << ",translated_url:" << translated_url
+            << ",drm_info: " << drm_info;
+
+  if (GetMediaPlayerClient() &&
+      GetMediaPlayerClient()->PlaybackNotificationEnabled() &&
+      blink::IsHbbTV() && !translated_url.empty())
+    url_ = media::GetCleanURL(translated_url);
+
+  if (url_.spec().find(".mpd") != std::string::npos)
+    stream_type_ = DASH_STREAM;
+  else if (url_.spec().find(".m3u") != std::string::npos)
+    stream_type_ = HLS_STREAM;
+  else if (mime_type_.find("application/dash+xml") != std::string::npos) {
+    char steaming_type_dash[] = "DASH";
+    char steaming_type_dash_ex[] = "DASHEX";
+    player_set_streaming_type(
+        player_, blink::IsHbbTV() ? steaming_type_dash_ex : steaming_type_dash);
+    stream_type_ = DASH_STREAM;
+  }
   if (blink::IsHbbTV() && CheckHighBitRate() && stream_type_ == DASH_STREAM)
     AppendUrlHighBitRate(url_.spec());
   MediaPlayerBridgeCapi::Prepare();
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackReady, player_id_);
 }
 
 void MediaPlayerBridgeCapiTV::Release() {
   StopSeekableTimeUpdateTimer();
   MediaPlayerBridgeCapi::Release();
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackStop, player_id_);
 }
 
 bool MediaPlayerBridgeCapiTV::Play() {
   if (!MediaPlayerBridgeCapi::Play())
     return false;
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackStart, player_id_);
   return true;
 }
 
 void MediaPlayerBridgeCapiTV::PlaybackCompleteUpdate() {
   MediaPlayerBridgeCapi::PlaybackCompleteUpdate();
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackFinish, player_id_);
 }  // namespace media
 
 void MediaPlayerBridgeCapiTV::PlayerPrepared() {
index 2aecbd4..3727dd6 100644 (file)
@@ -115,7 +115,9 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen {
       const media::AudioDecoderConfig& audio_config,
       esplusplayer_audio_stream_info* audio_stream_info);
   virtual bool ReadFromBufferQueue(DemuxerStream::Type type);
-  MediaPlayerTizenClient* GetMediaPlayerClient() const { return client_; }
+  MediaPlayerTizenClient* GetMediaPlayerClient() const override {
+    return client_;
+  }
   virtual esplusplayer_submit_status SubmitEsPacket(
       DemuxerStream::Type type,
       scoped_refptr<DecoderBuffer> buffer);
index 00c53d1..839fcd8 100644 (file)
@@ -21,6 +21,8 @@ MediaPlayerESPlusPlayerTV::~MediaPlayerESPlusPlayerTV() {
 void MediaPlayerESPlusPlayerTV::Initialize(VideoRendererSink* sink) {
   LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
   MediaPlayerESPlusPlayer::Initialize(sink);
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackLoad, player_id_);
 }
 
 void MediaPlayerESPlusPlayerTV::InitializeStreamConfig(
@@ -32,17 +34,24 @@ void MediaPlayerESPlusPlayerTV::InitializeStreamConfig(
 
 bool MediaPlayerESPlusPlayerTV::Play() {
   LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackStart, player_id_, "",
+                                                "", NULL, NULL, NULL);
   return MediaPlayerESPlusPlayer::Play();
 }
 
 void MediaPlayerESPlusPlayerTV::Prepare() {
   LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
   MediaPlayerESPlusPlayer::Prepare();
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackStop, player_id_);
 }
 
 void MediaPlayerESPlusPlayerTV::Release() {
   LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
   MediaPlayerESPlusPlayer::Release();
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackStop, player_id_);
 }
 
 void MediaPlayerESPlusPlayerTV::PostPrepareComplete() {
@@ -125,6 +134,8 @@ void MediaPlayerESPlusPlayerTV::OnPrepareComplete(bool result) {
 
 void MediaPlayerESPlusPlayerTV::OnEos() {
   MediaPlayerESPlusPlayer::OnEos();
+  if (GetMediaPlayerClient())
+    GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackFinish, player_id_);
 }
 
 }  // namespace media
index c097ec1..0835ecf 100644 (file)
@@ -36,6 +36,16 @@ enum class PlayerRole {
   LocalCaptureStream = RemotePeerStream << 1
 };
 
+enum PlaybackState {
+  kPlaybackLoad = 0,
+  // kPlaybackReady: player with both audio and video starts prepare and will
+  // acquire audio and video resources (if they are not already taken)
+  kPlaybackReady,
+  kPlaybackStart,
+  kPlaybackFinish,
+  kPlaybackStop,
+};
+
 using PlayerRoleFlags = media::Flags<PlayerRole>;
 
 DEFINE_OPERATORS_FOR_FLAGS(MediaTypeFlags)
@@ -72,7 +82,9 @@ class MEDIA_EXPORT MediaPlayerTizen {
   virtual void SetVolume(double volume) = 0;
   virtual base::TimeDelta GetCurrentTime() = 0;
 
-  virtual MediaPlayerTizenClient* GetMediaPlayerClient() const {return nullptr;}
+  virtual MediaPlayerTizenClient* GetMediaPlayerClient() const {
+    return nullptr;
+  }
   virtual void ToggleFullscreenMode(bool is_fullscreen) {}
 
 #if defined(TIZEN_TBM_SUPPORT)
index 71cb20d..95078d0 100644 (file)
@@ -55,6 +55,14 @@ class MEDIA_EXPORT MediaPlayerTizenClient {
 #endif
 
 #if BUILDFLAG(IS_TIZEN_TV)
+  virtual bool PlaybackNotificationEnabled() = 0;
+  virtual void NotifyPlaybackState(int state,
+                                   int player_id = 0,
+                                   const std::string& url = "",
+                                   const std::string& mime_type = "",
+                                   bool* media_resource_acquired = NULL,
+                                   std::string* translated_url = NULL,
+                                   std::string* drm_info = NULL) = 0;
   virtual content::WebContentsDelegate* GetWebContentsDelegate() const = 0;
 #endif
 };
index aebebfd..dcd44ee 100644 (file)
@@ -543,6 +543,7 @@ shared_library("chromium-ewk") {
     "public/ewk_media_parental_rating_info.h",
     "public/ewk_media_parental_rating_info_product.h",
     "public/ewk_media_playback_info.cc",
+    "public/ewk_media_playback_info.h",
     "public/ewk_media_playback_info_product.h",
     "public/ewk_media_subtitle_info.cc",
     "public/ewk_media_subtitle_info_product.h",
index 9e830c0..d7594ff 100644 (file)
 #include "devtools_port_manager.h"
 #include "private/ewk_file_chooser_request_private.h"
 #include "public/ewk_media_downloadable_font_info.h"
+#include "public/ewk_media_playback_info_product.h"
 #include "public/ewk_user_media_internal.h"
 #endif
 
@@ -3436,6 +3437,64 @@ void EWebView::NotifyDownloadableFontInfo(const char* scheme_id_uri,
   ewkMediaDownloadableFontInfoDelete(info);
 }
 
+std::vector<std::string> EWebView::NotifyPlaybackState(int state,
+                                                       int player_id,
+                                                       const char* url,
+                                                       const char* mime_type) {
+  std::vector<std::string> data;
+  Ewk_Media_Playback_Info* playback_info =
+      ewkMediaPlaybackInfoCreate(player_id, url, mime_type);
+
+  LOG(INFO)
+      << "player_id:" << player_id << ",state: " << state
+      << "(0-load : 1-videoready : 2-ready : 3-start : 4-finish : 5-stop)";
+  switch (state) {
+    case kPlaybackLoad:
+      SmartCallback<EWebViewCallbacks::PlaybackLoad>().call(
+          static_cast<void*>(playback_info));
+      break;
+    case kPlaybackReady:
+      SmartCallback<EWebViewCallbacks::PlaybackReady>().call(
+          static_cast<void*>(playback_info));
+      break;
+    case kPlaybackStart:
+      SmartCallback<EWebViewCallbacks::PlaybackStart>().call(
+          static_cast<void*>(playback_info));
+      break;
+    case kPlaybackFinish:
+      SmartCallback<EWebViewCallbacks::PlaybackFinish>().call(
+          static_cast<void*>(playback_info));
+      break;
+    case kPlaybackStop:
+      SmartCallback<EWebViewCallbacks::PlaybackStop>().call(
+          static_cast<void*>(playback_info));
+      break;
+    default:
+      NOTREACHED();
+      data.push_back("");
+      ewkMediaPlaybackInfoDelete(playback_info);
+      return data;
+  }
+
+  bool media_resource_acquired =
+      ewk_media_playback_info_media_resource_acquired_get(playback_info)
+          ? true
+          : false;
+  data.push_back(media_resource_acquired ? "mediaResourceAcquired" : "");
+  const char* translated_url =
+      ewk_media_playback_info_translated_url_get(playback_info);
+  data.push_back(translated_url ? std::string(translated_url) : "");
+  const char* drm_info = ewk_media_playback_info_drm_info_get(playback_info);
+  data.push_back(drm_info ? std::string(drm_info) : "");
+
+  LOG(INFO) << "evasObject: " << ewk_view_
+            << ", media_resource_acquired :" << media_resource_acquired
+            << ", translated_url:" << translated_url
+            << ", drm_info:" << drm_info;
+  ewkMediaPlaybackInfoDelete(playback_info);
+  return data;
+}
+
 void EWebView::NotifyMediaStateChanged(uint32_t device_type,
                                        uint32_t previous,
                                        uint32_t current) {
index 6cb3204..5cb5058 100644 (file)
@@ -380,6 +380,10 @@ class EWebView {
                                   const char* value,
                                   const char* data,
                                   int type);
+  std::vector<std::string> NotifyPlaybackState(int state,
+                                               int player_id,
+                                               const char* url,
+                                               const char* mime_type);
 #endif // IS_TIZEN_TV
   void SetSessionTimeout(uint64_t timeout);
   double GetTextZoomFactor() const;
@@ -983,6 +987,16 @@ class EWebView {
   bool is_high_bitrate_ = false;
 
   base::OnceClosure pending_setfocus_closure_;
+
+  enum PlaybackState {
+    kPlaybackLoad = 0,
+    // kPlaybackReady: player with both audio and video starts prepare and will
+    // acquire audio and video resources (if they are not already taken)
+    kPlaybackReady,
+    kPlaybackStart,
+    kPlaybackFinish,
+    kPlaybackStop,
+  };
 #endif
 
   std::unique_ptr<_Ewk_Back_Forward_List> back_forward_list_;
index 4f36ddb..4d40594 100644 (file)
@@ -40,42 +40,45 @@ struct _Ewk_Media_Playback_Info {
 
 const char* ewk_media_playback_info_media_url_get(
     Ewk_Media_Playback_Info* data) {
-  LOG_EWK_API_MOCKUP();
-  return NULL;
+  EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
+  return data->media_url;
 }
 
 const char* ewk_media_playback_info_mime_type_get(
     Ewk_Media_Playback_Info* data) {
-  LOG_EWK_API_MOCKUP();
-  return NULL;
+  EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
+  return data->mime_type;
 }
 
 const char* ewk_media_playback_info_translated_url_get(
     Ewk_Media_Playback_Info* data) {
-  LOG_EWK_API_MOCKUP();
-  return NULL;
+  EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
+  return data->translated_url;
 }
 
 const char* ewk_media_playback_info_drm_info_get(
     Ewk_Media_Playback_Info* data) {
-  LOG_EWK_API_MOCKUP();
-  return NULL;
+  EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
+  return data->drm_info;
 }
 
 void ewk_media_playback_info_media_resource_acquired_set(
     Ewk_Media_Playback_Info* data,
     Eina_Bool media_resource_acquired) {
-  LOG_EWK_API_MOCKUP();
+  if(data)
+    data->media_resource_acquired = media_resource_acquired;
 }
 
 void ewk_media_playback_info_translated_url_set(Ewk_Media_Playback_Info* data,
                                                 const char* translated_url) {
-  LOG_EWK_API_MOCKUP();
+  if(data)
+    data->translated_url = eina_stringshare_add(translated_url ? translated_url : "");
 }
 
 void ewk_media_playback_info_drm_info_set(Ewk_Media_Playback_Info* data,
                                           const char* drm_info) {
-  LOG_EWK_API_MOCKUP();
+  if(data)
+    data->drm_info = eina_stringshare_add(drm_info ? drm_info : "");
 }
 
 Ewk_Hardware_Decoders ewk_media_playback_info_decoder_get(
@@ -93,8 +96,8 @@ void ewk_media_playback_info_decoder_set(
 
 const int ewk_media_playback_info_video_id_get(Ewk_Media_Playback_Info* data)
 {
-  LOG_EWK_API_MOCKUP();
-  return 0;
+  EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
+  return data->video_id;
 }
 
 Ewk_Media_Playback_Info* ewkMediaPlaybackInfoCreate(const int player_id,
@@ -102,21 +105,26 @@ Ewk_Media_Playback_Info* ewkMediaPlaybackInfoCreate(const int player_id,
                                                     const char* mime_type)
 {
 #if BUILDFLAG(IS_TIZEN_TV)
-  LOG_EWK_API_MOCKUP();
-  return NULL;
+  Ewk_Media_Playback_Info* playback_info = new Ewk_Media_Playback_Info;
+  playback_info->video_id = player_id;
+  playback_info->media_url = eina_stringshare_add(url ? url : "");
+  playback_info->mime_type = eina_stringshare_add(mime_type ? mime_type : "");
+  playback_info->media_resource_acquired = false;
+  playback_info->translated_url = 0;
+  playback_info->drm_info = 0;
+  return playback_info;
 #else
   LOG_EWK_API_MOCKUP("Only for Tizen TV.");
   return NULL;
 #endif
-
 }
 
 Eina_Bool ewk_media_playback_info_media_resource_acquired_get(
     Ewk_Media_Playback_Info* data)
 {
 #if BUILDFLAG(IS_TIZEN_TV)
-  LOG_EWK_API_MOCKUP();
-  return EINA_FALSE;
+  EINA_SAFETY_ON_NULL_RETURN_VAL(data, false);
+  return data->media_resource_acquired;
 #else
   LOG_EWK_API_MOCKUP("Only for Tizen TV.");
   return EINA_FALSE;
@@ -126,7 +134,18 @@ Eina_Bool ewk_media_playback_info_media_resource_acquired_get(
 void ewkMediaPlaybackInfoDelete(Ewk_Media_Playback_Info* data)
 {
 #if BUILDFLAG(IS_TIZEN_TV)
-  LOG_EWK_API_MOCKUP();
+  if(!data)
+    return;
+
+  if (data->media_url)
+    eina_stringshare_del(data->media_url);
+  if (data->mime_type)
+    eina_stringshare_del(data->mime_type);
+  if (data->translated_url)
+    eina_stringshare_del(data->translated_url);
+  if (data->drm_info)
+    eina_stringshare_del(data->drm_info);
+  delete data;
 #else
   LOG_EWK_API_MOCKUP("Only for Tizen TV.");
 #endif
index 9f6b71b..5870cb3 100644 (file)
@@ -729,13 +729,25 @@ void ewk_settings_default_audio_input_device_set(Ewk_Settings* settings, const c
 
 void ewk_settings_media_playback_notification_set(Ewk_Settings* settings, Eina_Bool enabled)
 {
+#if BUILDFLAG(IS_TIZEN_TV)
+  EINA_SAFETY_ON_NULL_RETURN(settings);
+  LOG(INFO) << " set playback notification enabled:" << enabled;
+  settings->getPreferences().media_playback_notification_enabled = enabled;
+  ewkUpdateWebkitPreferences(settings->ewk_view());
+#else
   LOG_EWK_API_MOCKUP();
+#endif
 }
 
 Eina_Bool ewk_settings_media_playback_notification_get(const Ewk_Settings* settings)
 {
+#if BUILDFLAG(IS_TIZEN_TV)
+  EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+  return settings->getPreferences().media_playback_notification_enabled;
+#else
   LOG_EWK_API_MOCKUP();
   return EINA_FALSE;
+#endif
 }
 
 void ewk_settings_media_subtitle_notification_set(Ewk_Settings *settings, Eina_Bool enabled)
index f8a52dc..030db1b 100644 (file)
@@ -797,5 +797,27 @@ void WebContentsDelegateEfl::NotifyDownloadableFontInfo(
   web_view_->NotifyDownloadableFontInfo(scheme_id_uri.c_str(), value.c_str(),
                                         data.c_str(), type);
 }
+
+void WebContentsDelegateEfl::NotifyPlaybackState(int state,
+                                                 int player_id,
+                                                 const std::string& url,
+                                                 const std::string& mime_type,
+                                                 bool* media_resource_acquired,
+                                                 std::string* translated_url,
+                                                 std::string* drm_info) {
+  if (!web_view_)
+    return;
+  std::vector<std::string> data = web_view_->NotifyPlaybackState(
+      state, player_id, url.empty() ? "" : url.c_str(),
+      mime_type.empty() ? "" : mime_type.c_str());
+  if (data.size()) {
+    if (media_resource_acquired)
+      *media_resource_acquired = !data.at(0).empty() ? true : false;
+    if (translated_url)
+      *translated_url = data.at(1);
+    if (drm_info)
+      *drm_info = data.at(2);
+  }
+}
 #endif
 }  // namespace content
index 42fb4c7..a056dce 100644 (file)
@@ -81,6 +81,13 @@ class WebContentsDelegateEfl : public WebContentsDelegate {
                                   const std::string& value,
                                   const std::string& data,
                                   int type) override;
+  void NotifyPlaybackState(int state,
+                           int player_id,
+                           const std::string& url,
+                           const std::string& mime_type,
+                           bool* media_resource_acquired,
+                           std::string* translated_url,
+                           std::string* drm_info) override;
 #endif
   void RequestCertificateConfirm(
       WebContents* web_contents,