I have created an simple application which loads the HTML page in
webview(contains js,css) which has the video play. When we run the the APK file
in mobile, the video runs inside the webview. But when We install the same APK
inside the Google TV, and play the video , it plays in other player instead
inside the webview.
I have attached the apk with these, which we treid on Google TV.
Google TV logistics and android version is 3.2.
Code is
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.web_view_wizard);
initWebView();
}
private class SimpleWebChromeClient extends WebChromeClient {
/* (non-Javadoc)
* @see android.webkit.WebChromeClient#onShowCustomView(android.view.View, android.webkit.WebChromeClient.CustomViewCallback)
*/
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
super.onShowCustomView(view, callback);
//Log.w(RedditTVHDActivity.LOG_PREFIX, "In OnShowCustomView");
}
}
@Override
protected void onResume() {
super.onResume();
try {
WebView.class.getMethod("onResume").invoke(webView);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onPause() {
super.onPause();
try {
WebView.class.getMethod("onPause").invoke(webView);
} catch (Exception e) {
e.printStackTrace();
}
}
@SuppressLint("SetJavaScriptEnabled")
private void initWebView() {
webView = (WebView) findViewById(R.id.webview);
// WebViewの設定
WebSettings settings = webView.getSettings();
//settings.setJavaScriptEnabled(true);
settings.setAllowFileAccess(true);
if (Build.VERSION.SDK_INT > 7) {
settings.setPluginState(PluginState.ON);
} else {
settings.setPluginsEnabled(true);
}
webView.setWebChromeClient(new SimpleWebChromeClient());
settings.setJavaScriptEnabled(true);
settings.setUserAgentString("Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Large Screen Safari/534.24 GoogleTV/000000");
settings.setBuiltInZoomControls(true);
settings.setSupportZoom(true);
settings.setPluginsEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
// String html = "";
// html += "<html><body>";
// //html += "<iframe width=\"560\" height=\"315\"
src=\"http://www.youtube.com/embed/YULCa3CUquM?rel=0\" frameborder=\"0\"
allowfullscreen></iframe>";
// //html += "<iframe
src=\"http://fast.wistia.net/embed/iframe/8mdyxvq082?controlsVisibleOnLoad=true&
fullscreenButton=false&version=v1&videoHeight=360&videoWidth=640&volumeControl=t
rue\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"no\"
class=\"wistia_embed\" name=\"wistia_embed\" width=\"640\"
height=\"360\"></iframe>";
// //html += "<div id=\"wistia_qw9rimw4da\" class=\"wistia_embed\"
style=\"width:640px;height:360px;\" data-video-width=\"640\"
data-video-height=\"360\"> </div><script charset=\"ISO-8859-1\"
src=\"http://fast.wistia.com/static/concat/E-v1.js\"></script><script>wistiaEmbe
d = Wistia.embed(\"qw9rimw4da\", {version: \"v1\",videoWidth: 640,videoHeight:
360,volumeControl: true,fullscreenButton: false,controlsVisibleOnLoad:
true,autoPlay: true});</script>";
// html += "<iframe
src=\"http://fast.wistia.net/embed/iframe/qw9rimw4da?autoPlay=true&controlsVisib
leOnLoad=true&fullscreenButton=false&version=v1&videoHeight=360&videoWidth=640&v
olumeControl=true\" allowtransparency=\"true\" frameborder=\"0\"
scrolling=\"no\" class=\"wistia_embed\" name=\"wistia_embed\" width=\"640\"
height=\"360\"></iframe>";
// html += "</body></html>";
// System.out.println("the url is "+html);
// webView.loadData(html, "text/html", null);
String fileName = "html/theme/original-designs-one.html";
webView.loadUrl("file:///android_asset/" + fileName);
}
What is issue can you rectify?
Original issue reported on code.google.com by ashwin%b...@gtempaccount.com on 4 Jun 2013 at 12:49
Original issue reported on code.google.com by
ashwin%b...@gtempaccount.com
on 4 Jun 2013 at 12:49Attachments: