Skip to content
Permalink
Browse files

Fix #1162: add user agent workaround for YouTube TV (#1243)

  • Loading branch information
qaisjp committed Feb 2, 2020
1 parent a5508d8 commit e549fece9b655f084637083321ddee17240bc06f
Showing with 7 additions and 2 deletions.
  1. +7 −2 Client/cefweb/CWebView.cpp
@@ -625,7 +625,7 @@ void CWebView::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect)
rect.height = 1;
return;
}

rect.width = static_cast<int>(m_pWebBrowserRenderItem->m_uiSizeX);
rect.height = static_cast<int>(m_pWebBrowserRenderItem->m_uiSizeY);
}
@@ -841,6 +841,8 @@ CefResourceRequestHandler::ReturnValue CWebView::OnBeforeResourceLoad(CefRefPtr<
if (!CefParseURL(request->GetURL(), urlParts))
return RV_CANCEL; // Cancel if invalid URL (this line will normally not be executed)

SString domain = UTF16ToMbUTF8(urlParts.host.str);

// Add some information to the HTTP header
{
CefRequest::HeaderMap headerMap;
@@ -857,14 +859,17 @@ CefResourceRequestHandler::ReturnValue CWebView::OnBeforeResourceLoad(CefRefPtr<
if (GetProperty("mobile", strPropertyValue) && strPropertyValue == "1")
iter->second = iter->second.ToString() + "; Mobile Android";

// Allow YouTube TV to work (#1162)
if (domain == "www.youtube.com" && UTF16ToMbUTF8(urlParts.path.str) == "/tv")
iter->second = iter->second.ToString() + "; SMART-TV; Tizen 4.0";

request->SetHeaderMap(headerMap);
}
}

WString scheme = urlParts.scheme.str;
if (scheme == L"http" || scheme == L"https")
{
SString domain = UTF16ToMbUTF8(urlParts.host.str);
if (domain != "mta")
{
if (IsLocal())

0 comments on commit e549fec

Please sign in to comment.
You can’t perform that action at this time.