void ewk_media_start_with_high_bit_rate(Evas_Object* ewkView, Eina_Bool high_bitrate)
This API was added so that Dash streams can support Dash high bitrate.
Process the URL of the video.
migrate from:
https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/292658/
Change-Id: Ic452e289854b7efbca6ccb958f8a8f68eca3e7b2
Signed-off-by: yangzhiwen <zw714.yang@samsung.com>
virtual void NotifyMediaStateChanged(uint32_t type,
uint32_t previous,
uint32_t current) {};
+ virtual bool IsHighBitRate() const { return false; }
#endif
+
#if BUILDFLAG(IS_ANDROID)
// Updates information to determine whether a user gesture should carryover to
// future navigations. This is needed so navigations within a certain
is_suspended_ = true;
}
+#if BUILDFLAG(IS_TIZEN_TV)
+content::WebContentsDelegate* TizenRendererImpl::GetWebContentsDelegate()
+ const {
+ content::WebContents* web_contents = GetWebContents();
+ if (!web_contents) {
+ LOG(ERROR) << "web_contents is nullptr";
+ return nullptr;
+ }
+ return web_contents->GetDelegate();
+}
+#endif
+
void TizenRendererImpl::ToggleFullscreenMode(bool is_fullscreen,
ToggledFullscreenCB cb) {
if (media_player_)
uint32_t height) override;
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ content::WebContentsDelegate* GetWebContentsDelegate() const override;
+#endif
+
#if defined(TIZEN_VIDEO_HOLE)
void SetVideoHole(bool is_video_hole) final;
void SetMediaGeometry(const gfx::RectF& rect) final;
#include "media/base/media_export.h"
#include "url/gurl.h"
+#define BLINKFREE(p) \
+ do { \
+ if (p) { \
+ delete[] p; \
+ p = 0; \
+ } \
+ } while (0)
+
namespace media {
struct MediaFormatDeleter {
#include "media/filters/media_player_bridge_capi_tv.h"
+#include "media/base/efl/media_player_util_efl.h"
#include "tizen_src/chromium_impl/media/filters/media_player_tizen_client.h"
namespace {
}
void MediaPlayerBridgeCapiTV::Prepare() {
+ if (blink::IsHbbTV() && CheckHighBitRate() && stream_type_ == DASH_STREAM)
+ AppendUrlHighBitRate(url_.spec());
MediaPlayerBridgeCapi::Prepare();
}
return true;
}
+void MediaPlayerBridgeCapiTV::AppendUrlHighBitRate(const std::string& url) {
+ // don't use url.append("|STARTBITRATE=HIGHEST") to get hbbtv url
+ // "|" will be replaced with "%7C"
+ const char high_bitrate[] = "|STARTBITRATE=HIGHEST";
+ int len = url.length() + strlen(high_bitrate) + 1;
+ char* str_url = new char[len];
+ if (!str_url) {
+ return;
+ }
+
+ memset(str_url, 0, len);
+ strncat(str_url, url.c_str(), url.length());
+ strncat(str_url, high_bitrate, strlen(high_bitrate));
+ hbbtv_url_ = str_url;
+ BLINKFREE(str_url);
+ LOG(INFO) << "hbbtv url:" << hbbtv_url_.c_str();
+}
+
+bool MediaPlayerBridgeCapiTV::CheckHighBitRate() {
+ if (!GetMediaPlayerClient()) {
+ LOG(ERROR) << "MediaPlayerClient is null";
+ return false;
+ }
+ content::WebContentsDelegate* web_contents_delegate =
+ GetMediaPlayerClient()->GetWebContentsDelegate();
+ if (!web_contents_delegate) {
+ LOG(ERROR) << "get web_contents_delegate fail";
+ return false;
+ }
+ bool ret = web_contents_delegate->IsHighBitRate();
+ LOG(INFO) << "get high bit rate: " << std::boolalpha << ret;
+ return ret;
+}
+
} // namespace media
namespace media {
+enum StreamType {
+ HLS_STREAM = 0,
+ DASH_STREAM,
+ TS_STREAM,
+ OTHER_STREAM,
+};
+
// This class is focus on HBBTV/HLS feature on Tizen TV.
class MEDIA_EXPORT MediaPlayerBridgeCapiTV : public MediaPlayerBridgeCapi {
public:
void Release() override;
void SetContentMimeType(const std::string& mime_type) override;
void PlaybackCompleteUpdate() override;
+ void AppendUrlHighBitRate(const std::string& url);
+ bool CheckHighBitRate();
protected:
void PlayerPrepared() override;
void UpdateSeekableTime();
bool GetLiveStreamingDuration(int64_t* min, int64_t* max);
+ StreamType stream_type_{OTHER_STREAM};
+ std::string hbbtv_url_{""}; // url_ + HIGHBITRATE(if mpd)
std::string mime_type_ = "";
bool is_live_stream_ = false;
#include "base/task/single_thread_task_runner.h"
#include "media/base/demuxer_stream.h"
#include "media/filters/flags.h"
+#include "third_party/blink/public/platform/web_application_type.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/tbm_buffer_handle.h"
virtual void SetVolume(double volume) = 0;
virtual base::TimeDelta GetCurrentTime() = 0;
+ virtual MediaPlayerTizenClient* GetMediaPlayerClient() const {return nullptr;}
virtual void ToggleFullscreenMode(bool is_fullscreen) {}
#if defined(TIZEN_TBM_SUPPORT)
#ifndef MEDIA_FILTERS_MEDIA_PLAYER_TIZEN_CLIENT_H_
#define MEDIA_FILTERS_MEDIA_PLAYER_TIZEN_CLIENT_H_
+#include "content/public/browser/web_contents_delegate.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/pipeline_status.h"
#include "media/base/video_decoder_config.h"
uint32_t width,
uint32_t height) = 0;
#endif
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual content::WebContentsDelegate* GetWebContentsDelegate() const = 0;
+#endif
};
} // namespace media
delete user_media_state_info;
}
+
+void EWebView::SetHighBitRate(Eina_Bool high_bitrate) {
+ LOG(INFO) << "high_bitrate: " << std::boolalpha << high_bitrate;
+ is_high_bitrate_ = high_bitrate;
+}
#endif
void NotifyMediaStateChanged(uint32_t type,
uint32_t previous,
uint32_t current);
+ void SetHighBitRate(Eina_Bool is_high_bitrate);
+ bool IsHighBitRate() const { return is_high_bitrate_; }
#endif // IS_TIZEN_TV
void SetDidChangeThemeColorCallback(
bool use_early_rwi_;
bool rwi_info_showed_;
GURL rwi_gurl_;
+ bool is_high_bitrate_ = false;
base::OnceClosure pending_setfocus_closure_;
#endif
LOG_EWK_API_MOCKUP();
}
-void ewk_media_start_with_high_bit_rate(Evas_Object* ewkView, Eina_Bool is_high_bitrate)
+void ewk_media_start_with_high_bit_rate(Evas_Object* ewkView, Eina_Bool high_bitrate)
{
- LOG_EWK_API_MOCKUP();
+#if BUILDFLAG(IS_TIZEN_TV)
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
+ impl->SetHighBitRate(high_bitrate);
+#else
+ LOG_EWK_API_MOCKUP("Only for Tizen TV.");
+#endif
}
double ewk_view_media_current_time_get(const Evas_Object *o)
if (web_view_)
web_view_->InvokeEdgeScrollByCallback(offset, handled);
}
+
+bool WebContentsDelegateEfl::IsHighBitRate() const {
+ return web_view_ ? web_view_->IsHighBitRate() : false;
+}
#endif
} // namespace content
void NotifyMediaStateChanged(uint32_t type,
uint32_t previous,
uint32_t current) override;
+ bool IsHighBitRate() const override;
#endif
#if defined(TIZEN_AUTOFILL)