如何在web视图使用iframe来播放VIMEO视频? [英] how to play vimeo video using iframe in webview?

查看:537
本文介绍了如何在web视图使用iframe来播放VIMEO视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        WebView wv=(WebView)findViewById(R.id.webView1);

        wv.getSettings().setJavaScriptEnabled(true);
        wv.getSettings().setAppCacheEnabled(true);
        wv.getSettings().setDomStorageEnabled(true);

        // how plugin is enabled change in API 8
        if (Build.VERSION.SDK_INT < 8) {
          wv.getSettings().setPluginsEnabled(true);
        } else {
          wv.getSettings().setPluginState(PluginState.ON);
        }
        String venkat="<iframe src=\"http://player.vimeo.com/video/27244727?portrait=0&color=333\" width=\"WIDTH\" height=\"HEIGHT\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>";
        wv.loadData(venkat,"text/html","UTF-8");
    }}

在从谷歌研究我已经写了超过code,但它不是working.in这都没有出现错误,但是当我点击播放按钮进度条显示了一段时间,然后消失,再次显示层按钮..任何人都可以PLZ建议我该如何解决这个问题。

After researching from google i have written the above code but it not working.in this no errors are occurred but when i click on the play button progress bar is displaying for sometime and then it disappears and display ply button again.. could anyone plz suggest me how to solve this problem.

推荐答案

做到这一点:

<iframe src="//player.vimeo.com/video/VIDEO_ID" 
        width="515" 
        height="340" 
        frameborder="0" 
        webkitallowfullscreen mozallowfullscreen allowfullscreen>
</iframe>

这篇关于如何在web视图使用iframe来播放VIMEO视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆