如何从雅虎视频或youtube嵌入视频到Android

How Embed a Video from Yahoo Videos or youtube to Android

本文关键字:视频 Android youtube 雅虎      更新时间:2023-09-26

如何从youtube或雅虎视频嵌入视频到android应用程序我用的是Phonegap所以主要是写javascript然后代码被包装成本地代码

但我只写JS &HTML5

你很可能想使用指向嵌入视频超链接的WebView。

下列内容:

<LinearLayout ... >
     ... my content
    <WebView android:id="@+id/webView1" ... >
        ...
    </WebView>
</LinearLayout>
然后在代码中使用以下钩子(主要来自WebView文档):
WebView webview = (WebView) activity.getViewById(R.id.webView1);
// Simplest usage: note that an exception will NOT be thrown
// if there is an error loading this page (see below).
webview.loadUrl("http://slashdot.org/");
// OR, you can also load from an HTML string:
String summary = "<html><body>You scored <b>192</b> points.</body></html>";
webview.loadData(summary, "text/html", "utf-8");
// ... although note that there are restrictions on what this HTML can do.
// See the JavaDocs for loadData() and loadDataWithBaseURL() for more info.

不要忘记
<uses-permission android:name="android.permission.INTERNET" />