如何在web视图使用iframe来播放VIMEO视频?视图、如何在、视频、web

2023-09-13 00:29:51 作者:旧人乱人心

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>