我们如何使用 webview 在 Android 应用程序中播放 YouTube 嵌入代码? [英] How can we play YouTube embeded code in an Android application using webview?

查看:21
本文介绍了我们如何使用 webview 在 Android 应用程序中播放 YouTube 嵌入代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用 webview 在 Android 应用程序中播放 YouTube 嵌入代码?

How can we play YouTube embeded code in an Android application using webview?

推荐答案

查看以下 SO 帖子:如何在 WebView 上嵌入 YouTube 剪辑安卓

Check out the following SO post: How to embed a YouTube clip in a WebView on Android

尝试以下可能对您有所帮助的代码.我只是框出来供你参考

Try the following code which may help you. I just framed it for your reference

myWebView = (WebView) findViewById( R.id.webview_compontent );

String playVideo= "<html><body>Youtube video .. <br> <iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/bIPcobKMB94" frameborder="0"></body></html>"

myWebView.loadData(playVideo, "text/html", "utf-8");

如何使用Webview请参考以下链接:http://developer.android.com/reference/android/webkit/WebView.html

Refer the following link for how to use Webview: http://developer.android.com/reference/android/webkit/WebView.html

这篇关于我们如何使用 webview 在 Android 应用程序中播放 YouTube 嵌入代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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