I did a lot of research trying to figure out why the html5 videos would not play correctly in my application. To be more specific, the page loads perfectly, you can see the initial controls of the video player, but when you click on playback, you are here the sound from the video, but you canβt see anything.
I use webview to display it and use several online links for testing, for example:
Here is my webview code:
String _location = "http://broken-links.com/tests/video/"; WebView wv = (WebView) findViewById(R.id.dsWebView); wv.setWebChromeClient(new WebChromeClient()); //chromeClient()); wv.setWebViewClient(new HelloWebViewClient()); WebSettings webSettings = wv.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setBuiltInZoomControls(true); webSettings.setSupportZoom(true); webSettings.setUseWideViewPort(true); webSettings.setPluginsEnabled(true); webSettings.setPluginState(PluginState.ON); webSettings.setDomStorageEnabled(true); webSettings.setAllowFileAccess(true); wv.setInitialScale(50); wv.loadUrl(_location); private class HelloWebViewClient extends WebViewClient { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true;//false; } }
I also modified my project so that it is for android 4.0 and higher and set android: hardwareAccelerated = "true" in my manifest file.
To add, I tested both links in both my default browser on my htc one x and the Chrome beta, and it works fine on both. This is just my webview that doesn't work: (.
I'm mostly trying to figure out what I am missing in order to play the video correctly in my webview.
Thanks for any help in advance,
Fire
source share