i have a web site which i want to view on my web view.
I have created a sample application of web view to load the url of the web site.
This is my code of the activitiy. With this code i am to load other video specific web sites like youtube. From my desktop browser i can open the web site but not from this activity. I have videos to be rendered in my web site.
From my mobile chrome browser its not playing but playing from my stock browser. I even changed the user agent of the web view to be of my stock browser but same results.
package com.example.testcontent;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.webkit.WebSettings;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class WebViewActivity extends Activity
{
private final String TAG = "WebViewActivity";
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view);
WebView webView = (WebView) findViewById(R.id.webview);
WebSettings webViewSettings = webView.getSettings();
webViewSettings.setJavaScriptEnabled(true);
webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webViewSettings.setPluginState(PluginState.ON);
webView.getSettings().setAllowFileAccess(true);
webView.setSoundEffectsEnabled(true);
webView.setWebViewClient(new WebViewClient());
// 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");
Log.i(TAG, "User Agent used in the web view " + webViewSettings.getUserAgentString());
webView.loadUrl("http://mywebsite.com");
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.web_view, menu);
return true;
}
}
Also this is the log which i get
06-27 17:38:13.458: W/IInputConnectionWrapper(30916): reportFullscreenMode on inactive InputConnection
06-27 17:38:21.877: V/WebViewChromium(31760): Binding Chromium to the background looper Looper (main, tid 1) {41e47bb0}
06-27 17:38:21.877: I/chromium(31760): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
06-27 17:38:21.877: I/BrowserProcessMain(31760): Initializing chromium process, renderers=0
06-27 17:38:21.897: W/chromium(31760): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
06-27 17:38:21.907: I/Adreno-EGL(31760): <qeglDrvAPI_eglInitialize:316>: EGL 1.4 QUALCOMM build: (CL4169980)
06-27 17:38:21.907: I/Adreno-EGL(31760): OpenGL ES Shader Compiler Version: 17.01.10.SPL
06-27 17:38:21.907: I/Adreno-EGL(31760): Build Date: 12/25/13 Wed
06-27 17:38:21.907: I/Adreno-EGL(31760): Local Branch:
06-27 17:38:21.907: I/Adreno-EGL(31760): Remote Branch:
06-27 17:38:21.907: I/Adreno-EGL(31760): Local Patches:
06-27 17:38:21.907: I/Adreno-EGL(31760): Reconstruct Branch:
06-27 17:38:21.967: I/WebViewActivity(31760): User Agent used in the web view Mozilla/5.0 (Linux; Android 4.4.2; HTC One dual sim Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36
06-27 17:38:22.027: I/InputMethodManager(31760): [startInputInner] EditorInfo { packageName=com.example.testslccontent, inputType=0xa1, imeOptions=0x12000000, privateImeOptions=null }, windowGainingFocus=android.view.ViewRootImpl$W@41ea1b88, mServedView=android.webkit.WebView{41e7a8a0 VFEDHVC. .F....ID 48,48-1032,1653 #7f080000 app:id/webview}
06-27 17:38:22.027: W/AwContents(31760): nativeOnDraw failed; clearing to background color.
06-27 17:38:22.138: I/chromium(31760): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
06-27 17:38:22.168: I/chromium(31760): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
06-27 17:38:22.178: E/qdutils(31760): FBIOGET_FSCREENINFO failed
06-27 17:38:22.238: D/libc(31760): [NET] getaddrinfo+,hn 18(0x70726f78792e62),sn(),family 0,flags 1024
06-27 17:38:22.238: D/libc(31760): [NET] getaddrinfo-, 1
06-27 17:38:22.238: D/libc(31760): [NET] getaddrinfo_proxy+
06-27 17:38:22.238: D/libc(31760): [NET] getaddrinfo_proxy-, success
06-27 17:38:24.020: I/chromium(31760): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
Only error is coming from 06-27 17:38:22.178: E/qdutils(31760): FBIOGET_FSCREENINFO failed.
I am on 4.4.2. My code is compiled against API level 19.
cheers, Saurav