I have a web content which is a collection of html ,js and static content like images, videos etc.
When I host the web content in a web server in some other system. I can render them from my Android stock browser (Using HTC One 4.4.2) but not from Chrome browser.
If I take the content locally and serve it from an embedded web server (NanoHTTPD) in my application. (This is my actual use case) the videos in my web content are not rendering. Same problem happens when I am trying to load the same content as loadURL in my web view. So its seem its not the problem of how I am using the NanoHTTP server in my application and serving my content. Problem seems to be the configuration or rendering of Web View otherwise serving it from my system server would have worked.
In my web view I have enabled all the settings.Below is the code for the confugration of Web view.
webView = (WebView) findViewById(R.id.webView);
progressBar = (ProgressBar) findViewById(R.id.progressBarForWebView);
WebSettings webViewSettings = webView.getSettings();
webViewSettings.setJavaScriptEnabled(true);
webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webViewSettings.setPluginState(PluginState.ON);
webViewSettings
.setUserAgentString("Mozilla/5.0 (Linux; U; Android 4.4.2; en-in; HTC_One_dual_sim Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30");
String userAgentString = webViewSettings.getUserAgentString();
webView.getSettings().setAllowFileAccess(true);
webView.setSoundEffectsEnabled(true);
webView.setWebViewClient(new MyWebViewClient());
Even set the user agent to the string received from the stock browser. I read from the https://developer.chrome.com/multidevice/webview/overview that from 4.4 the rendering engine of Chrome and WebView is same.
Since my content does not run on Android Chrome but on Android Stock browser, would the web view also not render my content even if I change my user agent for it ? Any other ways to render my content ?
Cheers, Saurav