I am trying to load some HTML data into Android Webview. The data is in the form of a string downloaded from a web service, and the HTML may contain embedded YouTube videos that I want to embed in a row and make playable.
Everything works fine with LayoutAlgorithm.NORMAL . But when I use the SINGLE_COLUMN layout SINGLE_COLUMN , Youtube videos appear as black boxes that can no longer be played. I need one column format, since images inside HTML overflow the width of the web view in NORMAL mode. Here is my code for setting up webview.
// Set maximum image width to fit screen contentWebView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); // Make non focusable to prevent links from being selectable. contentWebView.setFocusableInTouchMode(false); contentWebView.setFocusable(false); // Enable HTML5 video contentWebView.getSettings().setJavaScriptEnabled(true); contentWebView.getSettings().setPluginState(PluginState.ON); contentWebView.setWebChromeClient(new WebChromeClient() { });
Is it possible to somehow make the video playable with the SINGLE_COLUMN layout or to emulate the layout of one column manually using the NORMAL layout algorithm? Any other ideas?
source share