当前位置: 动力学知识库 > 问答 > 编程问答 >

Can't play a youtube in an Android webview (API level 18+)

问题描述:

I've done it all...

 <activity

android:name=".FullscreenActivity"

android:hardwareAccelerated="true"

and this:

 webview.setWebChromeClient(new WebChromeClient());

and this:

 webview.getSettings().setJavaScriptEnabled(true);

webview.getSettings().setAllowFileAccess(true);

webview.getSettings().setAppCacheEnabled(true);

webview.getSettings().setDomStorageEnabled(true);

and this won't play from a remote website:

<iframe width="100%" height="100%" class="youtube-player"

type="text/html" src="http://www.youtube.com/embed/-SHwpedtwxc"

frameborder="0" allowfullscreen></iframe>'

Just a black box in the middle of the screen...

网友答案:

I removed the "allowfullscreen" and it started working:

<iframe width="100%" height="100%" class="youtube-player"     
type="text/html" src="http://www.youtube.com/embed/-SHwpedtwxc" 
frameborder="0" autoplay></iframe>
分享给朋友:
您可能感兴趣的文章:
随机阅读: