Android WebView One Column doesn't work with YouTube videos

牧云@^-^@ 提交于 2019-12-24 09:32:46

问题


I am loading RSS data from URL,and that RSS data can contain link to YouTube video.

Here is an example how link to youtube vide looks like:

div class="video-shortcode"><iframe title="YouTube video player" width="600" 
height="350" src="http://www.youtube.com/embed/HXrcUyCVA6c"
frameborder="0" allowfullscreen></iframe></div>

When I use this code, I get preview of YouTube video and I can play it, but images are to large as shown on the image below.

I used this code for WebView:

WebView desc;

WebSettings ws = desc.getSettings();

ws.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);

When I tried to use this code for WebView:

ws.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

It seems that YouTube videos dont work, because they are black, and I can't play them.

Looks like this:

来源:https://stackoverflow.com/questions/17791984/android-webview-one-column-doesnt-work-with-youtube-videos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!