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;
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,
#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
#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
#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
#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(
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_;
}
#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__;
return;
}
+#if BUILDFLAG(IS_TIZEN_TV)
+ shared_state_.renderer->SetContentMimeType(mime_type_);
+#endif
+
shared_state_.renderer->StartPlayingFrom(
std::max(seek_time, demuxer_->GetStartTime()));
{
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";
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());
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);
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;
Dispatch();
}
+#if BUILDFLAG(IS_TIZEN_TV)
+void PipelineController::SetContentMimeType(const std::string& mime_type) {
+ if (pipeline_)
+ pipeline_->SetContentMimeType(mime_type);
+}
+#endif
} // namespace media
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();
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());
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,
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
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:
[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
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) {
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,
{"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|.
#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;
}
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;
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) {
// blocking user's access to the background web content.
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;
virtual void SuspendPlayer() {}
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual WebString GetContentMIMEType() = 0;
+#endif
+
protected:
~WebMediaPlayerClient() = default;
};
virtual void SetVideoHoleEnabled(bool) = 0;
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual void SetMediaPlaybackNotificationEnabled(bool) = 0;
+ virtual bool MediaPlaybackNotificationEnabled() = 0;
+#endif
+
protected:
~WebSettings() = default;
};
}
#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);
#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)
#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)
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);
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;
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);
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.
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
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_;
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);
volume_(kDefaultVolume),
#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)),
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,
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,
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;
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};
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
virtual void UpdateDuration();
GURL url_;
- int player_id_ = 0;;
+ int player_id_ = 0;
int delayed_player_state_;
player_h player_ = nullptr;
}
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() {
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);
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(
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() {
void MediaPlayerESPlusPlayerTV::OnEos() {
MediaPlayerESPlusPlayer::OnEos();
+ if (GetMediaPlayerClient())
+ GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackFinish, player_id_);
}
} // namespace media
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)
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)
#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
};
"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",
#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
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) {
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;
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_;
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(
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,
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;
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
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)
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
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,